Skip to content

Commit f76ba02

Browse files
authored
Merge pull request #1417 from thewtex/hello-playwright
hello playwright
2 parents 38d2c83 + ad554d6 commit f76ba02

File tree

15 files changed

+320
-1049
lines changed

15 files changed

+320
-1049
lines changed

.github/workflows/javascript-typescript.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
3636
- uses: actions/setup-node@v4
3737
with:
38-
node-version: '20'
38+
node-version: '22'
3939

4040
- name: Install
4141
uses: pnpm/action-setup@v4

.github/workflows/playwright.yml

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,14 @@ jobs:
102102
node-version: '22'
103103
cache: pnpm
104104

105-
- name: Install Playwright Browsers
106-
run: pnpx playwright install --with-deps
107-
108105
- name: Install dependencies for itk-wasm
109106
run: pnpm install
110107
working-directory: packages/core/typescript/itk-wasm
111108

109+
- name: Install Playwright Browsers
110+
run: pnpm exec playwright install --with-deps
111+
working-directory: packages/core/typescript/itk-wasm
112+
112113
- name: Build itk-wasm
113114
run: |
114115
pnpm run --aggregate-output --filter itk-wasm build
@@ -174,11 +175,9 @@ jobs:
174175
node-version: '22'
175176
cache: pnpm
176177

177-
- name: Install Playwright Browsers
178-
run: pnpx playwright install --with-deps
179-
180178
- name: pnpm install
181179
run: pnpm install --frozen-lockfile
180+
182181
- name: Build itk-wasm
183182
run: |
184183
pnpm run --aggregate-output --filter itk-wasm build
@@ -202,6 +201,10 @@ jobs:
202201
run: |
203202
pnpm run --aggregate-output --filter "@itk-wasm/${{ matrix.package }}-build" test:data:download
204203
204+
- name: Install Playwright Browsers
205+
working-directory: packages/${{ matrix.package }}/typescript
206+
run: pnpm exec playwright install --with-deps
207+
205208
- name: Run Playwright tests
206209
working-directory: packages/${{ matrix.package }}/typescript
207210
run: pnpm run test:browser
@@ -212,3 +215,51 @@ jobs:
212215
name: playwright-report-${{ matrix.package }}
213216
path: packages/${{ matrix.package }}/typescript/playwright-report/
214217
retention-days: 30
218+
219+
test-hello-world-example:
220+
defaults:
221+
run:
222+
working-directory: ./examples/hello-world
223+
timeout-minutes: 60
224+
runs-on: ubuntu-24.04
225+
steps:
226+
- uses: actions/checkout@v4
227+
- name: Free Disk Space (Ubuntu)
228+
uses: jlumbroso/free-disk-space@main
229+
230+
- name: Pull latest Docker images
231+
working-directory: ./
232+
run: |
233+
./src/docker/pull.sh --no-debug
234+
235+
- uses: actions/setup-node@v4
236+
with:
237+
node-version: '22'
238+
239+
- name: Install
240+
uses: pnpm/action-setup@v4
241+
with:
242+
run_install: true
243+
244+
- name: Build itk-wasm
245+
run: |
246+
pnpm run --aggregate-output --filter itk-wasm build
247+
248+
- name: Install dependencies
249+
run: pnpm install
250+
251+
- name: Build
252+
run: pnpm run build
253+
254+
- name: Install Playwright Browsers
255+
run: pnpm exec playwright install --with-deps
256+
257+
- name: Run Playwright tests
258+
run: pnpm run test
259+
260+
- uses: actions/upload-artifact@v4
261+
if: ${{ !cancelled() }}
262+
with:
263+
name: playwright-report-hello-world
264+
path: playwright-report/
265+
retention-days: 30

examples/hello-world/.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
itk-wasm-hello-world
22
wasi-build
3-
cypress/support
4-
cypress/videos/
3+
/test-results/
4+
/playwright-report/
5+
/blob-report/
6+
/playwright/.cache/

examples/hello-world/cypress.config.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/hello-world/cypress/e2e/hello_world_spec.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/hello-world/cypress/plugins/index.cjs

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/hello-world/cypress/support/commands.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/hello-world/cypress/support/e2e.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/hello-world/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
"test": "pnpm run test:wasi && pnpm run test:node && pnpm run test:browser",
1212
"test:wasi": "pnpx itk-wasm run wasi-build/hello.wasi.wasm",
1313
"test:node": "node ./index.mjs",
14-
"cypress:open": "pnpm exec cypress open",
15-
"cypress:run": "pnpm exec cypress run",
1614
"start": "http-server --cors -p 8083",
17-
"test:browser": "start-server-and-test start http://localhost:8083 cypress:run"
15+
"test:browser": "playwright test",
16+
"test:browser:debug": "playwright test --debug"
1817
},
1918
"author": "Matt McCormick <[email protected]>",
2019
"license": "Apache-2.0",
@@ -23,8 +22,7 @@
2322
"itk-wasm": "workspace:^"
2423
},
2524
"devDependencies": {
26-
"cypress": "^14.0.0",
27-
"http-server": "^14.1.1",
28-
"start-server-and-test": "^2.0.10"
25+
"@playwright/test": "^1.48.2",
26+
"http-server": "^14.1.1"
2927
}
3028
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// @ts-check
2+
import { defineConfig, devices } from "@playwright/test";
3+
4+
/**
5+
* @see https://playwright.dev/docs/test-configuration.
6+
*/
7+
export default defineConfig({
8+
testDir: "./tests",
9+
/* Run tests in files in parallel */
10+
fullyParallel: true,
11+
/* Fail the build on CI if you accidentally left test.only in the source code. */
12+
forbidOnly: !!process.env.CI,
13+
/* Retry on CI only */
14+
retries: process.env.CI ? 2 : 0,
15+
/* Opt out of parallel tests on CI. */
16+
workers: process.env.CI ? 1 : undefined,
17+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
18+
reporter: "html",
19+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
20+
use: {
21+
/* Base URL to use in actions like `await page.goto('/')`. */
22+
baseURL: "http://localhost:8083",
23+
24+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
25+
trace: "on-first-retry",
26+
},
27+
28+
/* Configure projects for major browsers */
29+
projects: [
30+
{
31+
name: "chromium",
32+
use: { ...devices["Desktop Chrome"] },
33+
},
34+
],
35+
36+
/* Run your local dev server before starting the tests */
37+
webServer: {
38+
command: "pnpm start",
39+
url: "http://localhost:8083",
40+
reuseExistingServer: !process.env.CI,
41+
},
42+
});

0 commit comments

Comments
 (0)