diff --git a/packages/special-pages/package.json b/packages/special-pages/package.json index 6676102e5..e2ce23765 100644 --- a/packages/special-pages/package.json +++ b/packages/special-pages/package.json @@ -9,8 +9,8 @@ "build": "node index.mjs", "build.dev": "node index.mjs --env development", "test": "npm run test.unit && playwright test", - "test.windows": "npm run test -- --project duckplayer-windows", - "test.apple": "npm run test -- --project duckplayer-apple", + "test.windows": "npm run test -- --project windows", + "test.macos": "npm run test -- --project macos", "test.headed": "npm run test -- --headed", "test.ui": "npm run test -- --ui", "test.unit": "node --test unit-test/* ", diff --git a/packages/special-pages/playwright.config.js b/packages/special-pages/playwright.config.js index fccb0c85a..3dbec882b 100644 --- a/packages/special-pages/playwright.config.js +++ b/packages/special-pages/playwright.config.js @@ -3,8 +3,11 @@ import { defineConfig, devices } from '@playwright/test' export default defineConfig({ projects: [ { - name: 'duckplayer-windows', - testMatch: 'duckplayer.spec.js', + name: 'windows', + testMatch: [ + 'duckplayer.spec.js', + 'onboarding.spec.js' + ], use: { ...devices['Desktop Edge'], injectName: 'windows', @@ -12,35 +15,13 @@ export default defineConfig({ } }, { - name: 'duckplayer-apple', - testMatch: 'duckplayer.spec.js', - use: { - ...devices['Desktop Safari'], - injectName: 'apple', - platform: 'macos' - } - }, - { - name: 'sslerrorpage-apple', - testMatch: 'sslerror.spec.js', - use: { - ...devices['Desktop Safari'], - injectName: 'apple', - platform: 'macos' - } - }, - { - name: 'onboarding-windows', - testMatch: 'onboarding.spec.js', - use: { - ...devices['Desktop Edge'], - injectName: 'windows', - platform: 'windows' - } - }, - { - name: 'onboarding-apple', - testMatch: 'onboarding.spec.js', + name: 'macos', + testMatch: [ + 'duckplayer.spec.js', + 'onboarding.spec.js', + 'sslerror.spec.js' + + ], use: { ...devices['Desktop Safari'], injectName: 'apple', diff --git a/packages/special-pages/readme.md b/packages/special-pages/readme.md index b9bffbe86..ce7416b66 100644 --- a/packages/special-pages/readme.md +++ b/packages/special-pages/readme.md @@ -14,3 +14,41 @@ Would translate into the following build output - `build/windows/pages/duckplayer` This allows each respective platform to configure their integrations to use the known page. + +## Running Tests + +To run tests, use the script command `npm run test`. The process is as follows: + +```mermaid +graph TD +A[npm run test] --> B[Run 'pretest' script] +B --> C[Execute `npm run build.dev` to build all pages] +C --> E[Run test.unit] +E --> F[Execute unit tests in unit-test/*] +F --> G[Run playwright test] +G --> H[Execute Playwright tests] + +%% Adding conditional branches for project-specific tests +G --> I[Check if project is Windows] +G --> J[Check if project is Apple] + +I --> K[Execute npm run test.windows] +J --> L[Execute npm run test.apple] + +%% Continue with normal flow after conditional branches +K --> H +L --> H + +%% Adding branches for additional test scripts +G --> M[Check if --headed flag] +M --> N[Execute npm run test.headed] +N --> H + +G --> O[Check if --ui flag] +O --> P[Execute npm run test.ui] +P --> H +``` + +## Running tests for a single platform + +You can run `npm run test.windows` or `npm run test.macos` to run only tests for a single platform. Consult the file `playwright.config.js` to see what's available.