Goal-Calibration/cypress/support/commands.js
Yisroel Baum 71e5fb8fda
add cypress coverage for user text pages
loginAsSecondUser helper backs new specs that cover the
/texts list (own-only scoping, create form, link to
/texts/{id}) and /texts/{id} detail (own access, 403 on
another user's text, owner can add a child node).
2026-05-02 21:47:20 +03:00

19 lines
462 B
JavaScript

Cypress.Commands.add('login', (email, password) => {
cy.request({
method: 'POST',
url: '/api/auth/login',
body: { email, password },
})
})
Cypress.Commands.add('loginAsAdmin', () => {
cy.login('admin@example.com', 'admin1234')
})
Cypress.Commands.add('loginAsUser', () => {
cy.login('user@example.com', 'password1')
})
Cypress.Commands.add('loginAsSecondUser', () => {
cy.login('user2@example.com', 'password2')
})