- Add permissions logic for status options in corrective actions. - Create tests for permissions functionality. - Implement queries for user authentication and actions management. - Develop Actions page to display and manage corrective actions. - Create authentication pages for login, setup, and password reset. - Add IncidentDetail page to view incident details and associated actions. - Implement Settings page for user management and password changes.
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { expect, type Page } from '@playwright/test'
|
||
|
||
export const PASSWORD = 'e2e test password'
|
||
export const users = {
|
||
admin: { name: 'Avery Admin', email: 'admin@e2e.test' },
|
||
supervisor: { name: 'Sam Supervisor', email: 'supervisor@e2e.test' },
|
||
reporter: { name: 'Riley Reporter', email: 'reporter@e2e.test' },
|
||
} as const
|
||
|
||
export async function signIn(page: Page, who: keyof typeof users) {
|
||
await page.goto('/login')
|
||
await page.getByLabel('Email').fill(users[who].email)
|
||
await page.getByLabel('Password').fill(PASSWORD)
|
||
await page.getByRole('button', { name: 'Sign in', exact: true }).click()
|
||
await expect(page.getByRole('heading', { level: 1 })).toContainText(users[who].name.split(' ')[0])
|
||
}
|
||
|
||
/** A unique title so parallel tests (and the desktop/mobile projects) never collide. */
|
||
export const unique = (title: string) => `${title} ${Math.random().toString(36).slice(2, 7)}`
|
||
|
||
/** 1×1 PNG. */
|
||
export const photo = {
|
||
name: 'scene.png',
|
||
mimeType: 'image/png',
|
||
buffer: Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==', 'base64'),
|
||
}
|