Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

devops: use matrix in GHA, add non-linux rpc (#2907)

Pavel Feldmand561465214e0
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 9c15c8b896..9d856992a7 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -16,95 +16,12 @@ env:
FORCE_COLOR: 1
jobs:
- chromium_linux:
- name: "Chromium Linux"
- runs-on: ubuntu-18.04
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v1
- with:
- node-version: 10
- - uses: microsoft/playwright-github-action@v1
- - run: npm ci
- - run: npm run build
- - run: mkdir -p coredumps
- # Set core dump file name pattern
- - run: sudo bash -c 'echo "$(pwd -P)/coredumps/core-pid_%p.dump" > /proc/sys/kernel/core_pattern'
- # XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
- # Wrap `npm run` in a subshell to redirect STDERR to file.
- # Enable core dumps in the subshell.
- - run: xvfb-run --auto-servernum -- bash -c "ulimit -c unlimited && npm run ccoverage 2>./chromium-linux-testrun.log"
- env:
- DEBUG: "*"
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: chromium-linux-output
- path: test/output-chromium
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: chromium-linux-testrun.log
- path: chromium-linux-testrun.log
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: chromium-linux-coredumps
- path: coredumps
-
- chromium_mac:
- name: "Chromium Mac"
- runs-on: macos-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v1
- with:
- node-version: 10
- - uses: microsoft/playwright-github-action@v1
- - run: npm ci
- - run: npm run build
- - run: npm run ctest 2>./chromium-mac-testrun.log
- env:
- DEBUG: "*"
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: chromium-mac-output
- path: test/output-chromium
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: chromium-mac-testrun.log
- path: chromium-mac-testrun.log
-
- chromium_win:
- name: "Chromium Win"
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v1
- with:
- node-version: 10
- - uses: microsoft/playwright-github-action@v1
- - run: npm ci
- - run: npm run build
- - run: npm run ctest 2>./chromium-win-testrun.log
- shell: bash
- env:
- DEBUG: "*"
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: chromium-win-output
- path: test/output-chromium
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: chromium-win-testrun.log
- path: chromium-win-testrun.log
-
- webkit_linux:
- name: "WebKit Linux"
+ test_linux:
+ name: "Linux"
+ strategy:
+ fail-fast: false
+ matrix:
+ browser: [chromium, firefox, webkit]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
@@ -120,27 +37,32 @@ jobs:
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
# Wrap `npm run` in a subshell to redirect STDERR to file.
# Enable core dumps in the subshell.
- - run: xvfb-run --auto-servernum -- bash -c "ulimit -c unlimited && npm run wcoverage 2>./webkit-linux-testrun.log"
+ - run: xvfb-run --auto-servernum -- bash -c "ulimit -c unlimited && npm run coverage 2>./${{ matrix.browser }}-linux-testrun.log"
env:
+ BROWSER: ${{ matrix.browser }}
DEBUG: "*,-pw:wrapped*"
- uses: actions/upload-artifact@v1
if: failure()
with:
- name: webkit-linux-output
- path: test/output-webkit
+ name: ${{ matrix.browser }}-linux-output
+ path: test/output-${{ matrix.browser }}
- uses: actions/upload-artifact@v1
if: failure()
with:
- name: webkit-linux-testrun.log
- path: webkit-linux-testrun.log
+ name: ${{ matrix.browser }}-linux-testrun.log
+ path: ${{ matrix.browser }}-linux-testrun.log
- uses: actions/upload-artifact@v1
if: failure()
with:
- name: webkit-linux-coredumps
+ name: ${{ matrix.browser }}-linux-coredumps
path: coredumps
- webkit_mac:
- name: "WebKit Mac"
+ test_mac:
+ name: "macOS"
+ strategy:
+ fail-fast: false
+ matrix:
+ browser: [chromium, firefox, webkit]
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
@@ -150,22 +72,27 @@ jobs:
- uses: microsoft/playwright-github-action@v1
- run: npm ci
- run: npm run build
- - run: npm run wtest 2>./webkit-mac-testrun.log
+ - run: npm run test 2>./${{ matrix.browser }}-mac-testrun.log
env:
+ BROWSER: ${{ matrix.browser }}
DEBUG: "*,-pw:wrapped*"
- uses: actions/upload-artifact@v1
if: failure()
with:
- name: webkit-mac-output
- path: test/output-webkit
+ name: ${{ matrix.browser }}-mac-output
+ path: test/output-${{ matrix.browser }}
- uses: actions/upload-artifact@v1
if: failure()
with:
- name: webkit-mac-testrun.log
- path: webkit-mac-testrun.log
+ name: ${{ matrix.browser }}-mac-testrun.log
+ path: ${{ matrix.browser }}-mac-testrun.log
- webkit_win:
- name: "WebKit Win"
+ test_win:
+ name: "Windows"
+ strategy:
+ fail-fast: false
+ matrix:
+ browser: [chromium, firefox, webkit]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
@@ -175,107 +102,21 @@ jobs:
- uses: microsoft/playwright-github-action@v1
- run: npm ci
- run: npm run build
- - run: npm run wtest 2>./webkit-win-testrun.log
+ - run: npm run test 2>./${{ matrix.browser }}-win-testrun.log
shell: bash
env:
+ BROWSER: ${{ matrix.browser }}
DEBUG: "*,-pw:wrapped*"
- uses: actions/upload-artifact@v1
if: failure()
with:
- name: webkit-win-output
- path: test/output-webkit
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: webkit-win-testrun.log
- path: webkit-win-testrun.log
-
- firefox_linux:
- name: "Firefox Linux"
- runs-on: ubuntu-18.04
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v1
- with:
- node-version: 10
- - uses: microsoft/playwright-github-action@v1
- - run: npm ci
- - run: npm run build
- - run: mkdir -p coredumps
- # Set core dump file name pattern
- - run: sudo bash -c 'echo "$(pwd -P)/coredumps/core-pid_%p.dump" > /proc/sys/kernel/core_pattern'
- # XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
- # Wrap `npm run` in a subshell to redirect STDERR to file.
- # Enable core dumps in the subshell.
- - run: xvfb-run --auto-servernum -- bash -c "ulimit -c unlimited && npm run fcoverage 2>./firefox-linux-testrun.log"
- env:
- DEBUG: "*"
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: firefox-linux-output
- path: test/output-firefox
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: firefox-linux-testrun.log
- path: firefox-linux-testrun.log
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: firefox-linux-coredumps
- path: coredumps
-
- firefox_mac:
- name: "Firefox Mac"
- runs-on: macos-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v1
- with:
- node-version: 10
- - uses: microsoft/playwright-github-action@v1
- - run: npm ci
- - run: npm run build
- - run: npm run ftest 2>./firefox-mac-testrun.log
- env:
- DEBUG: "*"
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: firefox-mac-output
- path: test/output-firefox
+ name: ${{ matrix.browser }}-win-output
+ path: test/output-${{ matrix.browser }}
- uses: actions/upload-artifact@v1
if: failure()
with:
- name: firefox-mac-testrun.log
- path: firefox-mac-testrun.log
-
- firefox_win:
- name: "Firefox Win"
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v1
- with:
- node-version: 10
- - uses: microsoft/playwright-github-action@v1
- - run: npm ci
- - run: npm run build
- - run: npm run ftest 2>./firefox-win-testrun.log
- shell: bash
- env:
- DEBUG: "*"
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: firefox-win-output
- path: test/output-firefox
- - uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: firefox-win-testrun.log
- path: firefox-win-testrun.log
+ name: ${{ matrix.browser }}-win-testrun.log
+ path: ${{ matrix.browser }}-win-testrun.log
test-package-installations:
runs-on: ubuntu-latest
@@ -327,8 +168,12 @@ jobs:
name: headful-linux-coredumps
path: coredumps
- channel_linux:
- name: "Channel Chromium Linux"
+ rpc_linux:
+ name: "RPC Linux"
+ strategy:
+ fail-fast: false
+ matrix:
+ browser: [chromium, firefox, webkit]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
@@ -344,12 +189,13 @@ jobs:
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
# Wrap `npm run` in a subshell to redirect STDERR to file.
# Enable core dumps in the subshell.
- - run: xvfb-run --auto-servernum -- bash -c "ulimit -c unlimited && npm run ctest 2>./channel-linux-testrun.log"
+ - run: xvfb-run --auto-servernum -- bash -c "ulimit -c unlimited && npm run test 2>./channel-linux-testrun.log"
env:
- DEBUG: "*"
+ BROWSER: ${{ matrix.browser }}
+ DEBUG: "*,-pw:wrapped*"
PWCHANNEL: "1"
# Ensure output folder exists just in case it was not created by the test run.
- - run: node -e "require('fs').mkdirSync(require('path').join('test', 'output-chromium'), {recursive:true})"
+ - run: node -e "require('fs').mkdirSync(require('path').join('test', 'output-${{ matrix.browser }}'), {recursive:true})"
if: failure()
- uses: actions/upload-artifact@v1
if: failure()
diff --git a/package.json b/package.json
index 2da954a8ba..e4407deb16 100644
--- a/package.json
+++ b/package.json
@@ -15,15 +15,15 @@
"ctest": "cross-env BROWSER=chromium node --unhandled-rejections=strict test/test.js",
"ftest": "cross-env BROWSER=firefox node --unhandled-rejections=strict test/test.js",
"wtest": "cross-env BROWSER=webkit node --unhandled-rejections=strict test/test.js",
- "test": "cross-env BROWSER=all node --unhandled-rejections=strict test/test.js",
+ "test": "cross-env node --unhandled-rejections=strict test/test.js",
"cunit": "cross-env BROWSER=chromium node --unhandled-rejections=strict test/test.js",
"funit": "cross-env BROWSER=firefox node --unhandled-rejections=strict test/test.js",
"wunit": "cross-env BROWSER=webkit node --unhandled-rejections=strict test/test.js",
- "unit": "cross-env BROWSER=all node --unhandled-rejections=strict test/test.js",
+ "unit": "cross-env node --unhandled-rejections=strict test/test.js",
"ccoverage": "cross-env COVERAGE=true BROWSER=chromium node --unhandled-rejections=strict test/test.js",
"fcoverage": "cross-env COVERAGE=true BROWSER=firefox node --unhandled-rejections=strict test/test.js",
"wcoverage": "cross-env COVERAGE=true BROWSER=webkit node --unhandled-rejections=strict test/test.js",
- "coverage": "cross-env COVERAGE=true BROWSER=all node --unhandled-rejections=strict test/test.js",
+ "coverage": "cross-env COVERAGE=true node --unhandled-rejections=strict test/test.js",
"eslint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe --ext js,ts ./src || eslint --ext js,ts ./src",
"tsc": "tsc -p .",
"tsc-installer": "tsc -p ./src/install/tsconfig.json",
diff --git a/test/test.js b/test/test.js
index f1c0b48ed2..551735975f 100644
--- a/test/test.js
+++ b/test/test.js
@@ -171,7 +171,7 @@ module.exports = collect;
if (require.main === module) {
console.log('Testing on Node', process.version);
const browserNames = ['chromium', 'firefox', 'webkit'].filter(name => {
- return process.env.BROWSER === name || process.env.BROWSER === 'all';
+ return process.env.BROWSER === name || !process.env.BROWSER;
});
const testRunner = collect(browserNames);