import AxeBuilder from '@axe-core/playwright'; import { expect, test } from '@playwright/test'; import path from 'node:path'; const enabled = Boolean(process.env.PULSE_E2E_REAL_BASE_URL); test('real inventory exposes effective overrides, provenance and relations', async ({ page }, testInfo) => { test.skip(!enabled, 'Requires the isolated real PostgreSQL stack and inventory fixture.'); const login = await page.request.get('/auth/test-login'); expect(login.ok()).toBeTruthy(); await page.goto('/inventory'); await page.getByRole('searchbox', { name: 'Zoeken' }).fill('pulse-api'); const entity = page.getByRole('link', { name: /Pulse API · handmatig/ }); await expect(entity).toBeVisible(); await expect(entity).toContainText('1 bronnen · 2 feiten · 1 relaties · 2 correcties'); expect(await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth)).toBe(true); await entity.click(); await expect(page.getByRole('heading', { level: 1, name: 'Pulse API · handmatig' })).toBeVisible(); await expect(page.getByText('itworx/pulse:pinned', { exact: true })).toBeVisible(); await expect(page.getByText('Handmatige correctie').first()).toBeVisible(); await expect(page.getByText('Verouderd', { exact: true })).toBeVisible(); await expect(page.getByRole('link', { name: /PostgreSQL.*depends_on.*bevestigd/ })).toBeVisible(); expect(await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth)).toBe(true); const violations = await new AxeBuilder({ page }).analyze(); expect(violations.violations.filter((item) => ['serious', 'critical'].includes(item.impact ?? ''))).toEqual([]); if (process.env.PULSE_CAPTURE_VISUALS) await page.screenshot({ path: path.resolve('../../artifacts/evidence/M11-05', `inventory-${testInfo.project.name}.png`), fullPage: true }); });