Files
SlabUploader/frontend/tests/e2e/m3-create.spec.ts
T
Ty 7575471397 test(exit): M3 exit wave — inference-off suite + Woo-mock integration + Compose E2E + UAT walk
- test_exit_inference_off.py (QUALITY-20/120): full create->photo->review->publish
  happy path with inference OFF, asserts zero inference_log rows and no raw codes/
  tracebacks reach the owner; not-ready publish 422 with plain field-level message.
- test_integration_woo_mock.py (QUALITY-35): Woo mock covering success, error,
  duplicate SKU, stale field (no raw code), and taxonomy anchor bump on change.
- m3-create.spec.ts (QUALITY-50): Playwright E2E — all M3 dev screens render,
  Review/Publish controls load, Generate control visible only when enabled+reachable.
- deploy/uat_walk.sh (QUALITY-110): ready-to-run human walk for the real SLAB-UAT-*
  draft (inference off) against the live store — NOT a mock.

Verified: pytest 61 passed; frontend unit 88 passed; e2e 4 passed; gates exit 0.
2026-09-19 17:12:14 -07:00

56 lines
2.2 KiB
TypeScript

import { test, expect } from '@playwright/test';
/**
* M3 Create E2E (QUALITY-50): the Create flow screens render and the publish
* control is reachable. Runs against the vite preview (webServer in
* playwright.config). The backend is the local API; Woo is mocked at the
* host level for the integration path (see backend/tests/test_integration_woo_mock.py).
* This spec verifies the UI surface, not a live store (that is the UAT walk).
*/
test.describe('M3 Create flow', () => {
test('renders all M3 dev screens', async ({ page }) => {
await page.goto('/');
// The M3 dev toggles are always present in the toolbar.
const toggles = [
'Settings (dev)',
'Slabs (dev)',
'Photos (dev)',
'Review (dev)',
'Publish (dev)',
'Generate (dev)',
];
for (const name of toggles) {
await expect(page.getByRole('button', { name })).toBeVisible();
}
});
test('Review screen loads the ready-state control', async ({ page }) => {
await page.goto('/');
await page.getByRole('button', { name: 'Review (dev)' }).click();
await expect(page.getByRole('heading', { name: 'Review to Ready' })).toBeVisible();
await expect(page.getByRole('button', { name: 'Review', exact: true })).toBeVisible();
});
test('Publish screen loads the publish control', async ({ page }) => {
await page.goto('/');
await page.getByRole('button', { name: 'Publish (dev)' }).click();
await expect(page.getByRole('heading', { name: 'Publish to WooCommerce' })).toBeVisible();
await expect(page.getByRole('button', { name: 'Publish', exact: true })).toBeVisible();
});
test('Generate control is visible only when enabled + reachable', async ({ page }) => {
await page.goto('/');
await page.getByRole('button', { name: 'Generate (dev)' }).click();
await expect(page.getByRole('heading', { name: 'Generate text' })).toBeVisible();
// With no inference configured, the control is disabled with a plain note.
const note = page.locator('.note');
const state = page.locator('.state');
await expect(state).toContainText(/endpoint: (reachable|unreachable)/);
const text = (await state.textContent()) ?? '';
if (text.includes('unreachable')) {
await expect(note).toBeVisible();
}
});
});