/** * Sprint 17: визуальные screenshots каждого шага wizard'а для отчёта. * * Шаги 1-4 captured как `wizard-step-N.png`. Используется один build() * на весь файл — caпture'ы быстрые. */ import { expect, test } from '@playwright/test' import { OrgFactory, type BuiltOrg } from '../factories/OrgFactory.js' import { attachSession } from '../lib/ui.js' let built: BuiltOrg test.beforeAll(async () => { built = await OrgFactory.for('wiz-shots').build() }) test('wizard step 1 (магазин)', async ({ page }) => { await attachSession(page, built.session, '/onboarding-wizard') await page.waitForLoadState('networkidle') await expect(page).toHaveScreenshot('wizard-step-1.png') }) test('wizard step 2 (товар)', async ({ page }) => { await attachSession(page, built.session, '/onboarding-wizard') await page.waitForLoadState('networkidle') await page.getByRole('button', { name: 'Пропустить', exact: true }).first().click() await page.waitForLoadState('networkidle') await expect(page).toHaveScreenshot('wizard-step-2.png') }) test('wizard step 3 (сотрудник)', async ({ page }) => { await attachSession(page, built.session, '/onboarding-wizard') await page.waitForLoadState('networkidle') await page.getByRole('button', { name: 'Пропустить', exact: true }).first().click() await page.waitForLoadState('networkidle') await page.getByRole('button', { name: 'Пропустить', exact: true }).first().click() await page.waitForLoadState('networkidle') await expect(page).toHaveScreenshot('wizard-step-3.png') }) test('wizard step 4 (demo-данные)', async ({ page }) => { await attachSession(page, built.session, '/onboarding-wizard') await page.waitForLoadState('networkidle') await page.getByRole('button', { name: 'Пропустить', exact: true }).first().click() await page.waitForLoadState('networkidle') await page.getByRole('button', { name: 'Пропустить', exact: true }).first().click() await page.waitForLoadState('networkidle') await page.getByRole('button', { name: /Сделать позже/i }).click() await page.waitForLoadState('networkidle') await expect(page).toHaveScreenshot('wizard-step-4.png') }) test('help page', async ({ page }) => { await attachSession(page, built.session, '/help') await page.waitForLoadState('networkidle') await expect(page).toHaveScreenshot('help-page.png') }) test('admin diagnostic page', async ({ page }) => { await attachSession(page, built.session, '/admin/diagnostic') await page.waitForLoadState('networkidle') // Запускаем check'и для screenshot'a с реальным результатом. await page.getByRole('button', { name: /Запустить/i }).click() await page.waitForTimeout(2000) await expect(page).toHaveScreenshot('admin-diagnostic.png', { fullPage: true }) })