- Implemented Form301 component for displaying OSHA Form 301 equivalent, including employee and case information. - Created Osha component to manage OSHA recordkeeping, including tabs for 300 Log, 300A Summary, Hours & rates, and Submit to OSHA. - Added functionality for printing and downloading CSV files for OSHA submissions. - Integrated loading and error handling states for data fetching.
28 lines
1.2 KiB
TypeScript
28 lines
1.2 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' },
|
||
safety_manager: { name: 'Morgan Manager', email: 'manager@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'),
|
||
}
|