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 committed Oct 31, 2024
1 parent 8f23f04 commit 5c3dfe3
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 5c3dfe3

Please sign in to comment.