Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simpler playwright test definitions for special pages #996

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/special-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/* ",
Expand Down
43 changes: 12 additions & 31 deletions packages/special-pages/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,25 @@
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',
platform: 'windows'
}
},
{
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',

Check failure on line 22 in packages/special-pages/playwright.config.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Unexpected trailing comma

],
use: {
...devices['Desktop Safari'],
injectName: 'apple',
Expand Down
38 changes: 38 additions & 0 deletions packages/special-pages/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
shakyShane marked this conversation as resolved.
Show resolved Hide resolved

## 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.
Loading