import { test, expect, type Page } from '@playwright/test' async function scan(page: Page) { await page.goto('/login') await page.getByLabel('Email').fill('admin@example.com') await page.getByLabel('Password').fill('admin-password-123') await page.getByRole('button', { name: 'Sign in' }).click() await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible() await page.goto('/vulnerabilities') await page.getByRole('button', { name: 'Scan now' }).click() await expect(page.getByTestId('scope-host-critical')).not.toHaveText('0', { timeout: 20_000 }) } test('packages and images are one row each and expand to their CVEs', async ({ page }) => { await scan(page) // host: a row per package, no CVE ids until a row is opened const zlib = page.getByRole('row', { name: /^zlib1g/ }) await expect(zlib).toBeVisible() await expect(page.getByRole('row', { name: /CVE-2023-45853/ })).toHaveCount(0) await zlib.click() await expect(page.getByRole('row', { name: /CVE-2023-45853/ })).toBeVisible() await expect(zlib).toHaveAttribute('aria-expanded', 'true') await zlib.click() await expect(page.getByRole('row', { name: /CVE-2023-45853/ })).toHaveCount(0) // containers: a row per image that expands to the CVEs of that image await page.getByTestId('scope-container').click() const image = page.getByRole('row', { name: /gitea\/gitea/ }).first() await expect(image).toBeVisible() await expect(page.getByRole('row', { name: /CVE-2024-24790/ })).toHaveCount(0) await image.click() await expect(page.getByRole('row', { name: /CVE-2024-24790/ })).toBeVisible() })