Skip to content

Commit 29dd30a

Browse files
authored
Merge pull request #4735 from Tyriar/playwright
Start @playwright/test migration
2 parents 2dd4dfd + 68c5723 commit 29dd30a

File tree

32 files changed

+3814
-3229
lines changed

32 files changed

+3814
-3229
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"src/headless/tsconfig.json",
1414
"test/api/tsconfig.json",
1515
"test/benchmark/tsconfig.json",
16+
"test/playwright/tsconfig.json",
1617
"addons/xterm-addon-attach/src/tsconfig.json",
1718
"addons/xterm-addon-attach/test/tsconfig.json",
1819
"addons/xterm-addon-canvas/src/tsconfig.json",

.github/workflows/ci.yml

Lines changed: 88 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ jobs:
9090
- uses: actions/download-artifact@v3
9191
with:
9292
name: build-artifacts
93-
- name: Unzip artifacts (Linux, macOS)
94-
if: runner.os != 'Windows'
95-
run: unzip -o compressed-build.zip
96-
- name: Unzip artifacts (Windows)
97-
if: runner.os == 'Windows'
98-
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
99-
- name: Print directory structure
100-
run: ls -R
93+
- name: Unzip artifacts
94+
shell: bash
95+
run: |
96+
if [ "$RUNNER_OS" == "Windows" ]; then
97+
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
98+
else
99+
unzip -o compressed-build.zip
100+
fi
101+
ls -R
101102
- name: Unit test coverage
102103
run: |
103104
yarn test-unit-coverage --forbid-only
@@ -131,14 +132,15 @@ jobs:
131132
- uses: actions/download-artifact@v3
132133
with:
133134
name: build-artifacts
134-
- name: Unzip artifacts (Linux, macOS)
135-
if: runner.os != 'Windows'
136-
run: unzip -o compressed-build.zip
137-
- name: Unzip artifacts (Windows)
138-
if: runner.os == 'Windows'
139-
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
140-
- name: Print directory structure
141-
run: ls -R
135+
- name: Unzip artifacts
136+
shell: bash
137+
run: |
138+
if [ "$RUNNER_OS" == "Windows" ]; then
139+
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
140+
else
141+
unzip -o compressed-build.zip
142+
fi
143+
ls -R
142144
- name: Unit tests
143145
run: yarn test-unit --forbid-only
144146

@@ -164,14 +166,15 @@ jobs:
164166
- uses: actions/download-artifact@v3
165167
with:
166168
name: build-artifacts
167-
- name: Unzip artifacts (Linux, macOS)
168-
if: runner.os != 'Windows'
169-
run: unzip -o compressed-build.zip
170-
- name: Unzip artifacts (Windows)
171-
if: runner.os == 'Windows'
172-
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
173-
- name: Print directory structure
174-
run: ls -R
169+
- name: Unzip artifacts
170+
shell: bash
171+
run: |
172+
if [ "$RUNNER_OS" == "Windows" ]; then
173+
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
174+
else
175+
unzip -o compressed-build.zip
176+
fi
177+
ls -R
175178
- name: Unit tests
176179
run: yarn test-unit --forbid-only
177180

@@ -204,17 +207,61 @@ jobs:
204207
- uses: actions/download-artifact@v3
205208
with:
206209
name: build-artifacts
207-
- name: Unzip artifacts (Linux, macOS)
208-
if: runner.os != 'Windows'
209-
run: unzip -o compressed-build.zip
210-
- name: Unzip artifacts (Windows)
211-
if: runner.os == 'Windows'
212-
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
213-
- name: Print directory structure
214-
run: ls -R
210+
- name: Unzip artifacts
211+
shell: bash
212+
run: |
213+
if [ "$RUNNER_OS" == "Windows" ]; then
214+
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
215+
else
216+
unzip -o compressed-build.zip
217+
fi
218+
ls -R
215219
- name: Integration tests (${{ matrix.browser }})
216220
run: yarn test-api-${{ matrix.browser }} --headless --forbid-only
217221

222+
test-playwright-parallel:
223+
timeout-minutes: 20
224+
strategy:
225+
matrix:
226+
node-version: [18] # just one as integration tests are about testing in browser
227+
runs-on: [ubuntu] # macos is flaky
228+
browser: [chromium, firefox, webkit]
229+
runs-on: ${{ matrix.runs-on }}-latest
230+
steps:
231+
- uses: actions/checkout@v3
232+
- name: Use Node.js ${{ matrix.node-version }}.x
233+
uses: actions/setup-node@v3
234+
with:
235+
node-version: ${{ matrix.node-version }}.x
236+
cache: 'yarn'
237+
- name: Install dependencies
238+
run: |
239+
yarn --frozen-lockfile
240+
yarn install-addons
241+
- name: Install playwright
242+
run: npx playwright install --with-deps ${{ matrix.browser }}
243+
- name: Wait for build job
244+
uses: NathanFirmo/wait-for-other-job@v1.1.1
245+
with:
246+
token: ${{ secrets.GITHUB_TOKEN }}
247+
job: build
248+
- uses: actions/download-artifact@v3
249+
with:
250+
name: build-artifacts
251+
- name: Unzip artifacts
252+
shell: bash
253+
run: |
254+
if [ "$RUNNER_OS" == "Windows" ]; then
255+
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
256+
else
257+
unzip -o compressed-build.zip
258+
fi
259+
ls -R
260+
- name: Build demo
261+
run: yarn build-demo
262+
- name: Integration tests
263+
run: yarn test-playwright-${{ matrix.browser }} --forbid-only
264+
218265
test-api:
219266
needs: build
220267
timeout-minutes: 20
@@ -240,13 +287,14 @@ jobs:
240287
- uses: actions/download-artifact@v3
241288
with:
242289
name: build-artifacts
243-
- name: Unzip artifacts (Linux, macOS)
244-
if: runner.os != 'Windows'
245-
run: unzip -o compressed-build.zip
246-
- name: Unzip artifacts (Windows)
247-
if: runner.os == 'Windows'
248-
run: 7z x compressed-build.zip -aoa -o${{ github.workspace }}
249-
- name: Print directory structure
250-
run: ls -R
290+
- name: Unzip artifacts
291+
shell: bash
292+
run: |
293+
if [ "$RUNNER_OS" == "Windows" ]; then
294+
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
295+
else
296+
unzip -o compressed-build.zip
297+
fi
298+
ls -R
251299
- name: Integration tests (${{ matrix.browser }})
252300
run: yarn test-api-${{ matrix.browser }} --headless --forbid-only

addons/xterm-addon-attach/test/AttachAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import WebSocket = require('ws');
77
import { openTerminal, pollFor, launchBrowser } from '../../../out-test/api/TestUtils';
8-
import { Browser, Page } from 'playwright';
8+
import { Browser, Page } from '@playwright/test';
99

1010
const APP = 'http://127.0.0.1:3001/test';
1111

addons/xterm-addon-fit/test/FitAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { assert } from 'chai';
77
import { openTerminal, launchBrowser } from '../../../out-test/api/TestUtils';
8-
import { Browser, Page } from 'playwright';
8+
import { Browser, Page } from '@playwright/test';
99

1010
const APP = 'http://127.0.0.1:3001/test';
1111

addons/xterm-addon-image/test/ImageAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { assert } from 'chai';
77
import { openTerminal, launchBrowser, pollFor } from '../../../out-test/api/TestUtils';
8-
import { Browser, Page } from 'playwright';
8+
import { Browser, Page } from '@playwright/test';
99
import { IImageAddonOptions } from '../src/Types';
1010
import { FINALIZER, introducer, sixelEncode } from 'sixel';
1111
import { readFileSync } from 'fs';

addons/xterm-addon-search/test/SearchAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { assert } from 'chai';
77
import { readFile } from 'fs';
88
import { resolve } from 'path';
99
import { openTerminal, writeSync, launchBrowser, timeout } from '../../../out-test/api/TestUtils';
10-
import { Browser, Page } from 'playwright';
10+
import { Browser, Page } from '@playwright/test';
1111

1212
const APP = 'http://127.0.0.1:3001/test';
1313

addons/xterm-addon-serialize/test/SerializeAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { assert } from 'chai';
77
import { openTerminal, writeSync, launchBrowser } from '../../../out-test/api/TestUtils';
8-
import { Browser, Page } from 'playwright';
8+
import { Browser, Page } from '@playwright/test';
99

1010
const APP = 'http://127.0.0.1:3001/test';
1111

addons/xterm-addon-unicode11/test/Unicode11Addon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { assert } from 'chai';
77
import { openTerminal, launchBrowser } from '../../../out-test/api/TestUtils';
8-
import { Browser, Page } from 'playwright';
8+
import { Browser, Page } from '@playwright/test';
99

1010
const APP = 'http://127.0.0.1:3001/test';
1111

addons/xterm-addon-web-links/test/WebLinksAddon.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { assert } from 'chai';
77
import { openTerminal, pollFor, writeSync, launchBrowser } from '../../../out-test/api/TestUtils';
8-
import { Browser, Page } from 'playwright';
8+
import { Browser, Page } from '@playwright/test';
99

1010
const APP = 'http://127.0.0.1:3001/test';
1111

addons/xterm-addon-webgl/test/WebglRenderer.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { assert } from 'chai';
7-
import { Browser, Page } from 'playwright';
7+
import { Browser, Page } from '@playwright/test';
88
import { ITheme } from 'xterm';
99
import { getBrowserType, launchBrowser, openTerminal, pollFor, writeSync } from '../../../out-test/api/TestUtils';
1010
import { ITerminalOptions } from '../../../src/common/Types';

0 commit comments

Comments
 (0)