Native Web Components playground

Nova v3.37.0

Preview

Web Components

Playwright E2E

Playwright E2E Guide for Nova Web Components Consumers

This guide mirrors the canonical Nova Playwright approach and focuses on what matters for native web component integration.

Why Playwright

  • Real integration path: validates browser DOM event -> web component event/state behavior.
  • Lower flakiness: auto-waiting and retryable assertions reduce async timing failures.
  • Audit evidence: built-in traces, screenshots, and videos.
  • Operational simplicity: no separate WebDriver binary lifecycle.

Minimal Setup

bashnpm install -D @playwright/test
npx playwright install
ts// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  testDir: './tests/e2e',
  retries: process.env.CI ? 2 : 0,
  use: {
    headless: true,
    trace: 'on-first-retry',
  },
  projects: [{ name: 'chromium', use: { browserName: 'chromium' } }],
});

Test Scope Configuration (include/exclude)

Documenting include/exclude is important for maintainability and audit clarity.

ts// playwright.config.ts
export default defineConfig({
  testDir: './tests',
  testMatch: ['**/*.e2e.spec.ts'],
  testIgnore: ['**/helpers/**', '**/*.unit.spec.ts', '**/dist/**'],
});

Native-Relevant Example

tsimport { test, expect } from '@playwright/test';

test('Web component page renders and reacts to Nova interaction', async ({ page }) => {
  await page.goto('/');

  await expect(page.locator('nv-button')).toBeVisible();

  // stable selector pattern
  await page.locator('[data-scope="close-alert"]').click();
});

Use data-scope / data-testid selectors for stable tests.

M1 / On-Prem Note

This is documented in internal documentation only: Elia Group M1 usage documentation

Further Reading