Extracted from oil project — business logic removed, auth/db/deploy infrastructure generalized with APP_NAME placeholders. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24 lines
613 B
JavaScript
24 lines
613 B
JavaScript
Cypress.on('uncaught:exception', (err) => {
|
|
if (err.message.includes('ResizeObserver')) return false
|
|
return true
|
|
})
|
|
|
|
// Login as admin via token injection
|
|
Cypress.Commands.add('loginAsAdmin', () => {
|
|
cy.request('GET', '/api/users').then((res) => {
|
|
const admin = res.body.find(u => u.role === 'admin')
|
|
if (admin) {
|
|
cy.window().then(win => {
|
|
win.localStorage.setItem('auth_token', admin.token)
|
|
})
|
|
}
|
|
})
|
|
})
|
|
|
|
// Login with a specific token
|
|
Cypress.Commands.add('loginWithToken', (token) => {
|
|
cy.window().then(win => {
|
|
win.localStorage.setItem('auth_token', token)
|
|
})
|
|
})
|