Skip to content

Commit 5c3dfe3

Browse files
committed
test: started setup for pages which are behind auth
1 parent 8f23f04 commit 5c3dfe3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cypress/support/commands.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,16 @@
2222
//
2323
//
2424
// -- This will overwrite an existing command --
25-
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
26+
27+
// start of a login command with sessions
28+
// TODO: resolve issues with the CSRF token
29+
Cypress.Commands.add('login', (username, password) => {
30+
cy.session([username, password], () => {
31+
cy.visit('/login');
32+
cy.get('[data-test=username]').type(username);
33+
cy.get('[data-test=password]').type(password);
34+
cy.get('[data-test=login]').click();
35+
cy.url().should('contain', '/admin/profile');
36+
});
37+
});

0 commit comments

Comments
 (0)