2024-02-28 06:41:34 +01:00
|
|
|
/// <reference types="cypress" />
|
|
|
|
|
2024-03-01 02:40:49 +01:00
|
|
|
Cypress.Commands.add('dataCy', (value: string) => {
|
2024-02-28 06:41:34 +01:00
|
|
|
return cy.get(`[data-cy=${value}]`);
|
|
|
|
});
|
2024-03-01 02:40:49 +01:00
|
|
|
|
|
|
|
Cypress.Commands.add('login', (username: string, password: string) => {
|
|
|
|
cy.session(
|
|
|
|
[username, password],
|
|
|
|
() => {
|
|
|
|
cy.visit('/login');
|
|
|
|
cy.dataCy('input-username').type(username);
|
|
|
|
cy.dataCy('input-password').type(password);
|
|
|
|
cy.dataCy('button-submit').click();
|
|
|
|
cy.url().should('eq', Cypress.config().baseUrl + '/dashboard');
|
|
|
|
},
|
|
|
|
{
|
|
|
|
validate: () => {
|
|
|
|
cy.visit('/profile');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
cy.visit('/dashboard');
|
|
|
|
});
|