Skip to content

Commit

Permalink
test: started setup for pages which are behind auth
Browse files Browse the repository at this point in the history
  • Loading branch information
06kellyjac authored and Sabarivasan-Velayutham committed Nov 8, 2024
1 parent 505fae3 commit 823da96
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

// start of a login command with sessions
// TODO: resolve issues with the CSRF token
Cypress.Commands.add('login', (username, password) => {
cy.session([username, password], () => {
cy.visit('/login');
cy.get('[data-test=username]').type(username);
cy.get('[data-test=password]').type(password);
cy.get('[data-test=login]').click();
cy.url().should('contain', '/admin/profile');
});
});

0 comments on commit 823da96

Please sign in to comment.