Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
TEST test 91.108.112.237:3001 to frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Capryc0rne committed Aug 22, 2024
1 parent 6ac47bd commit aad1068
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions frontend/cypress/e2e/loginPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ import { loginAsSuperAdmin } from "./utils";

describe('Login page', () => {
it('Login with empty email and password', () => {
cy.visit('http://91.108.112.237:3001/connexion');
cy.visit('http://frontend/connexion');
cy.get(':nth-child(4) > .ant-row > .ant-col > .ant-form-item-control-input > .ant-form-item-control-input-content > .ant-btn').should('be.visible').click();

// Check if error messages are displayed
cy.get('#logInForm_email_help > .ant-form-item-explain-error').and('contain', 'Veuillez entrer votre adresse e-mail');
cy.get('#logInForm_password_help > .ant-form-item-explain-error').should('be.visible').and('contain', 'Veuillez entrer votre mot de passe');
cy.url().should('eq', 'http://91.108.112.237:3001/connexion');
cy.url().should('eq', 'http://frontend/connexion');
});

it('Login with right credentials', () => {
loginAsSuperAdmin();
});

it('Login with wrong credentials', () => {
cy.visit('http://91.108.112.237:3001/connexion');
cy.visit('http://frontend/connexion');
cy.intercept('POST', '/api/login').as('loginRequest');

cy.get('#logInForm_email').type('[email protected]');
cy.get('#logInForm_password').type('ee');
cy.get(':nth-child(4) > .ant-row > .ant-col > .ant-form-item-control-input > .ant-form-item-control-input-content > .ant-btn').should('be.visible').click();
cy.url().should('eq', 'http://91.108.112.237:3001/connexion');
cy.url().should('eq', 'http://frontend/connexion');

// input fields should be empty
cy.get('#logInForm_email').should('have.value', '');
Expand All @@ -37,7 +37,7 @@ describe('Login page', () => {
cy.intercept('POST', '/api/login').as('loginRequest');

// Visit the login page
cy.visit('http://91.108.112.237:3001/connexion');
cy.visit('http://frontend/connexion');

// Enter the login credentials
cy.get('#logInForm_email').should('be.visible').type('[email protected]');
Expand All @@ -46,7 +46,7 @@ describe('Login page', () => {
// Submit the form
cy.get(':nth-child(4) > .ant-row > .ant-col > .ant-form-item-control-input > .ant-form-item-control-input-content > .ant-btn').should('be.visible').click();

cy.url().should('eq', 'http://91.108.112.237:3001/connexion');
cy.url().should('eq', 'http://frontend/connexion');

// Wait for the login request to complete
cy.wait('@loginRequest').its('response.statusCode').should('eq', 403);
Expand All @@ -57,15 +57,15 @@ describe('Login page', () => {
cy.intercept('POST', '/api/login').as('loginRequest');

// Visit the login page
cy.visit('http://91.108.112.237:3001/connexion');
cy.visit('http://frontend/connexion');

// Enter the login credentials
cy.get('#logInForm_email').should('be.visible').type('[email protected]');
cy.get('#logInForm_password').should('be.visible').type('aze');

// Submit the form
cy.get(':nth-child(4) > .ant-row > .ant-col > .ant-form-item-control-input > .ant-form-item-control-input-content > .ant-btn').should('be.visible').click();
cy.url().should('eq', 'http://91.108.112.237:3001/connexion');
cy.url().should('eq', 'http://frontend/connexion');

// Wait for the login request to complete
cy.wait('@loginRequest').its('response.statusCode').should('eq', 403);
Expand All @@ -75,7 +75,7 @@ describe('Login page', () => {

// toggle password visibility
it('Toggle password visibility', () => {
cy.visit('http://91.108.112.237:3001/connexion');
cy.visit('http://frontend/connexion');
cy.get('#logInForm_password').type('aze');
cy.get('.ant-form-item-has-success > .ant-row > .ant-form-item-control > .ant-form-item-control-input > .ant-form-item-control-input-content > .ant-input-affix-wrapper > .ant-input-suffix').click();
cy.get('#logInForm_password').should('have.attr', 'type', 'text');
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const loginAsSuperAdmin = () => {
cy.intercept('POST', '/api/login').as('loginRequest');

// Visit the login page
cy.visit('http://91.108.112.237:3001/connexion');
cy.visit('http://frontend/connexion');

// Enter the login credentials
cy.get('#logInForm_email').should('be.visible').type('[email protected]');
Expand Down

0 comments on commit aad1068

Please sign in to comment.