Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: test on Node.js 20 (#22651)
Max Schmitt1f7223eb21b0
diff --git a/.github/workflows/tests_components.yml b/.github/workflows/tests_components.ymlindex d2909fbeee..bd1d4396b3 100644--- a/.github/workflows/tests_components.yml+++ b/.github/workflows/tests_components.yml@@ -29,7 +29,6 @@ jobs:- uses: actions/checkout@v3- uses: actions/setup-node@v3with:- # Component tests require Node.js 16+ (they require ESM via TS)node-version: 16- run: npm i -g npm@8- run: npm cidiff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.ymlindex 43ed9b9428..9e3881dd0d 100644--- a/.github/workflows/tests_primary.yml+++ b/.github/workflows/tests_primary.yml@@ -38,6 +38,9 @@ jobs:- os: ubuntu-22.04node-version: 18browser: chromium+ - os: ubuntu-22.04+ node-version: 20+ browser: chromiumruns-on: ${{ matrix.os }}steps:- uses: actions/checkout@v3@@ -241,7 +244,6 @@ jobs:- uses: actions/checkout@v3- uses: actions/setup-node@v3with:- # Component tests require Node.js 16+ (they require ESM via TS)node-version: 16- run: npm cienv:diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.ymlindex 1fa3214680..956ea6a9a8 100644--- a/.github/workflows/tests_secondary.yml+++ b/.github/workflows/tests_secondary.yml@@ -102,9 +102,9 @@ jobs:matrix:include:- os: ubuntu-latest- node_version: "^18.0.0"+ node_version: 18- os: ubuntu-latest- node_version: "^16.0.0"+ node_version: 20timeout-minutes: 30steps:- uses: actions/checkout@v3diff --git a/tests/config/testserver/index.ts b/tests/config/testserver/index.tsindex 230e1ee065..ded1c1c7d5 100644--- a/tests/config/testserver/index.ts+++ b/tests/config/testserver/index.ts@@ -256,7 +256,7 @@ export class TestServer {if (err) {response.statusCode = 404;response.setHeader('Content-Type', 'text/plain');- response.end(`File not found: ${filePath}`);+ response.end(request.method !== 'HEAD' ? `File not found: ${filePath}` : null);return;}const extension = filePath.substring(filePath.lastIndexOf('.') + 1);@@ -269,9 +269,9 @@ export class TestServer {const result = await gzipAsync(data);// The HTTP transaction might be already terminated after async hop here.if (!response.writableEnded)- response.end(result);+ response.end(request.method !== 'HEAD' ? result : null);} else {- response.end(data);+ response.end(request.method !== 'HEAD' ? data : null);}}diff --git a/tests/library/browsercontext-storage-state.spec.ts b/tests/library/browsercontext-storage-state.spec.tsindex 8319ef892e..bf64f2c074 100644--- a/tests/library/browsercontext-storage-state.spec.ts+++ b/tests/library/browsercontext-storage-state.spec.ts@@ -209,5 +209,8 @@ it('should handle malformed file', async ({ contextFactory }, testInfo) => {const error = await contextFactory({storageState: file,}).catch(e => e);- expect(error.message).toContain(`Error reading storage state from ${file}:\nUnexpected token o in JSON at position 1`);+ if (+process.versions.node.split('.')[0] > 18)+ expect(error.message).toContain(`Error reading storage state from ${file}:\nUnexpected token 'o', \"not-json\" is not valid JSON`);+ else+ expect(error.message).toContain(`Error reading storage state from ${file}:\nUnexpected token o in JSON at position 1`);});