add scoped coverage reporting

This commit is contained in:
4gray committed 2026-06-02 15:02:24 +02:00
1 parent ade043d427
commit fb576d7a78
31 files changed
+1407 -45

No files matched your search

+15
View File
@@ -28,6 +28,21 @@ const reuseExistingWebServer = isStaticPwaE2E ? false : !process.env['CI'];
export default defineConfig({
...nxE2EPreset(__filename, { testDir: './src' }),
testMatch: ['**/*.e2e.ts'],
reporter: [
['list'],
[
'html',
{
outputFolder: '../../dist/playwright-report/web-e2e',
},
],
[
'json',
{
outputFile: '../../dist/test-results/web-e2e/results.json',
},
],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
+3 -3
View File
@@ -1,9 +1,9 @@
import { expect, test } from '@playwright/test';
import { join } from 'path';
import { expect, test } from './fixtures';
const fixturePath = join(__dirname, 'fixtures/test.m3u');
test('basic test', async ({ page }) => {
test('@web @m3u basic playlist import flow', async ({ page }) => {
await page.goto('/');
// Basic checks
@@ -31,7 +31,7 @@ test('basic test', async ({ page }) => {
await expect(page.getByText('4. HappyKids TV')).toBeVisible();
});
test('keyboard shortcuts help opens from question mark', async ({ page }) => {
test('@web keyboard shortcuts help opens from question mark', async ({ page }) => {
await page.goto('/');
await page.getByRole('button', { name: 'Open keyboard shortcuts' }).focus();
+41
View File
@@ -0,0 +1,41 @@
import { test as base, expect, type Page } from '@playwright/test';
import { mkdir, writeFile } from 'node:fs/promises';
import path from 'node:path';
function safeArtifactName(value: string): string {
return value
.replace(/[^a-z0-9]+/gi, '-')
.replace(/^-+|-+$/g, '')
.slice(0, 120);
}
export const test = base.extend<{ page: Page }>({
page: async ({ page }, use, testInfo) => {
if (process.env['IPTVNATOR_E2E_V8_COVERAGE'] !== '1') {
await use(page);
return;
}
await page.coverage.startJSCoverage({ resetOnNavigation: false });
await page.coverage.startCSSCoverage({ resetOnNavigation: false });
try {
await use(page);
} finally {
const [js, css] = await Promise.all([
page.coverage.stopJSCoverage(),
page.coverage.stopCSSCoverage(),
]);
const coverageDir = path.join(testInfo.outputDir, 'v8-coverage');
const artifactName = safeArtifactName(testInfo.titlePath.join(' '));
await mkdir(coverageDir, { recursive: true });
await writeFile(
path.join(coverageDir, `${artifactName || 'test'}.json`),
`${JSON.stringify({ css, js }, null, 4)}\n`
);
}
},
});
export { expect };
+2 -2
View File
@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test';
import { expect, test } from './fixtures';
// eslint-disable-next-line playwright/no-skipped-test -- Static PWA assertions require the built service worker artifact.
test.skip(
@@ -6,7 +6,7 @@ test.skip(
'Static PWA stylesheet regression test only runs against the built PWA output.'
);
test('@pwa-static PWA build applies the full stylesheet under CSP', async ({
test('@pwa @pwa-static PWA build applies the full stylesheet under CSP', async ({
page,
}) => {
const cspConsoleErrors: string[] = [];
+2 -1
View File
@@ -1,4 +1,5 @@
import { expect, type Locator, type Page, test } from '@playwright/test';
import type { Locator, Page } from '@playwright/test';
import { expect, test } from './fixtures';
const WEB_BACKEND_URL = 'http://localhost:3333';
const XTREAM_MOCK_PORT = process.env['XTREAM_MOCK_PORT'] ?? '3211';
+6 -5
View File
@@ -1,5 +1,6 @@
import { expect, Page, test } from '@playwright/test';
import type { Page } from '@playwright/test';
import { join } from 'path';
import { expect, test } from './fixtures';
async function openSettings(page: Page) {
await page.locator('a[href$="/workspace/settings"]').click();
@@ -22,12 +23,12 @@ test.describe('Settings', () => {
await page.goto('/');
});
test('Check settings page', async ({ page }) => {
test('@settings @web Check settings page', async ({ page }) => {
await openSettings(page);
await page.locator('.settings-back-button').click();
});
test('Change video player', async ({ page }) => {
test('@settings @web Change video player', async ({ page }) => {
await openSettings(page);
const playerSelect = page.locator('[data-test-id="select-video-player"]');
@@ -47,7 +48,7 @@ test.describe('Settings', () => {
);
});
test('Change app theme', async ({ page }) => {
test('@settings @web Change app theme', async ({ page }) => {
await openSettings(page);
// v0.22 compact theme picker exposes the segmented control as a
// radiogroup with options labelled just "Light"/"Dark"/"System".
@@ -72,7 +73,7 @@ test.describe('Settings', () => {
).toHaveAttribute('aria-checked', 'true');
});
test('Change app language', async ({ page }) => {
test('@settings @web Change app language', async ({ page }) => {
await openSettings(page);
const languageSelect = page.locator('[data-test-id="select-language"]');
+1 -2
View File
@@ -1,10 +1,9 @@
import {
expect,
type APIRequestContext,
type Locator,
type Page,
test,
} from '@playwright/test';
import { expect, test } from './fixtures';
import {
getRegisteredProviderUrl,
interceptProviderTargetRegistration,
+2 -1
View File
@@ -1,4 +1,5 @@
import { APIRequestContext, test, expect, Page } from '@playwright/test';
import type { APIRequestContext, Page } from '@playwright/test';
import { expect, test } from './fixtures';
import {
getRegisteredProviderUrl,
interceptProviderTargetRegistration,