- 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.
39 lines
1.8 KiB
TypeScript
39 lines
1.8 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
import { signIn, unique } from './fixtures'
|
|
|
|
test('shows leading and lagging indicators with charts that have table views', async ({ page }) => {
|
|
await signIn(page, 'safety_manager')
|
|
await page.goto('/analytics?range=365')
|
|
await expect(page.getByRole('heading', { name: 'Leading indicators' })).toBeVisible()
|
|
await expect(page.getByText('Hazards & near misses reported')).toBeVisible()
|
|
await expect(page.getByRole('heading', { name: 'Lagging indicators' })).toBeVisible()
|
|
|
|
// Every chart has a table view
|
|
const trend = page.locator('figure').filter({ hasText: 'Reports per' })
|
|
await trend.getByRole('button', { name: 'Table' }).click()
|
|
await expect(trend.getByRole('columnheader', { name: 'Hazards & near misses' })).toBeVisible()
|
|
})
|
|
|
|
test('filters and saved views', async ({ page, isMobile }) => {
|
|
test.skip(isMobile, 'Covered on desktop')
|
|
await signIn(page, 'supervisor')
|
|
await page.goto('/analytics')
|
|
await page.getByLabel('Date range').selectOption('30')
|
|
await page.getByLabel('Incident type').selectOption('hazard')
|
|
await expect(page).toHaveURL(/range=30/)
|
|
await expect(page).toHaveURL(/type=hazard/)
|
|
|
|
const name = unique('Hazards this month')
|
|
await page.getByRole('button', { name: 'Save view' }).click()
|
|
await page.getByLabel('View name').fill(name)
|
|
await page.getByRole('button', { name: 'Save', exact: true }).click()
|
|
await expect(page.getByLabel('Saved views')).toHaveValue(/.+/)
|
|
|
|
// Clearing the filters and picking the view brings them back
|
|
await page.goto('/analytics')
|
|
await expect(page.getByLabel('Incident type')).toHaveValue('')
|
|
await page.getByLabel('Saved views').selectOption({ label: name })
|
|
await expect(page.getByLabel('Incident type')).toHaveValue('hazard')
|
|
await expect(page.getByLabel('Date range')).toHaveValue('30')
|
|
})
|