50 Playwright E2E tests across 13 spec files covering all routes and user flows (items CRUD, check-out/in, locations, labels, scanning, search/filter). Uses vitest as runner with playwright-core for browser automation (bun-compatible alternative to @playwright/test). Includes Gherkin .feature files as living documentation, test support infrastructure (IDB seeding, item factories, assertion helpers, layout measurement), and HANDOFF.md covering project state, deployment, and open design decisions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
/**
|
|
* @feature Labels
|
|
* @see e2e/features/pages/labels.feature
|
|
*/
|
|
import { describe, test, expect } from 'vitest';
|
|
import { setupBrowser } from '../../support/browser';
|
|
import { waitForAppReady } from '../../support/seed';
|
|
import { expectVisible, expectText, expectDisabled } from '../../support/expect';
|
|
|
|
const { getPage } = setupBrowser();
|
|
|
|
describe('Labels', () => {
|
|
test('label page shows stats', async () => {
|
|
const page = getPage();
|
|
await page.goto('/labels');
|
|
await waitForAppReady(page);
|
|
|
|
await expectText(page.getByRole('heading', { level: 1 }), 'Labels');
|
|
await expectVisible(page.getByText('Available IDs'));
|
|
await expectVisible(page.getByText('Assigned Items'));
|
|
});
|
|
|
|
test('batch size options are available', async () => {
|
|
const page = getPage();
|
|
await page.goto('/labels');
|
|
await waitForAppReady(page);
|
|
|
|
// Options inside <select> are not "visible" in the DOM sense — check they exist
|
|
const select = page.locator('#batchSize');
|
|
await select.waitFor({ state: 'visible', timeout: 5000 });
|
|
const options = await select.locator('option').allTextContents();
|
|
expect(options).toContain('10 IDs');
|
|
expect(options).toContain('50 IDs (1 sheet)');
|
|
});
|
|
|
|
test('generate button is present', async () => {
|
|
const page = getPage();
|
|
await page.goto('/labels');
|
|
await waitForAppReady(page);
|
|
|
|
await expectVisible(page.getByRole('button', { name: 'Generate' }));
|
|
});
|
|
|
|
test('print button disabled when no IDs', async () => {
|
|
const page = getPage();
|
|
await page.goto('/labels');
|
|
await waitForAppReady(page);
|
|
|
|
await expectDisabled(page.getByRole('button', { name: /Download PDF/ }));
|
|
});
|
|
});
|