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).
19 lines
462 B
JavaScript
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')
|
|
})
|