From 0af4664b8a9103b8cf746d799e7f60eaf49bd987 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Fri, 3 May 2024 10:31:21 +0200 Subject: [PATCH] test: add canary specific expectation file (#12383) --- .github/workflows/canary.yml | 2 ++ test/CanaryTestExpectations.json | 16 ++++++++++++++++ tools/merge-canary-test-expectations.mjs | 20 ++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 test/CanaryTestExpectations.json create mode 100644 tools/merge-canary-test-expectations.mjs diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index c321d6f9fd7..a291f68d3d8 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -55,6 +55,8 @@ jobs: - name: Install Chrome Canary id: browser run: node tools/download_chrome_canary.mjs $HOME/.cache/puppeteer/chrome-canary + - name: Apply Canary expectations + run: node tools/merge-canary-test-expectations.mjs - name: Run all tests (for non-Linux) if: ${{ matrix.os != 'ubuntu-latest' }} run: npm run test -- --shard '${{ matrix.shard }}' --test-suite ${{ matrix.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json diff --git a/test/CanaryTestExpectations.json b/test/CanaryTestExpectations.json new file mode 100644 index 00000000000..4df2dc924ba --- /dev/null +++ b/test/CanaryTestExpectations.json @@ -0,0 +1,16 @@ +[ + { + "testIdPattern": "[pdf.spec] Page.pdf can print to PDF with outline", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "headful"], + "expectations": ["PASS"], + "comment": "fixed in canary" + }, + { + "testIdPattern": "[pdf.spec] Page.pdf can print to PDF with outline", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "headless"], + "expectations": ["PASS"], + "comment": "fixed in canary" + } +] diff --git a/tools/merge-canary-test-expectations.mjs b/tools/merge-canary-test-expectations.mjs new file mode 100644 index 00000000000..d79e43cf6dd --- /dev/null +++ b/tools/merge-canary-test-expectations.mjs @@ -0,0 +1,20 @@ +/** + * @license + * Copyright 2024 Google Inc. + * SPDX-License-Identifier: Apache-2.0 + */ + +// Modifies test/TestExpectations.json in place. + +import fs from 'fs'; + +const source = 'test/TestExpectations.json'; +const testExpectations = JSON.parse(fs.readFileSync(source, 'utf-8')); +const canaryTestExpectations = JSON.parse( + fs.readFileSync('test/CanaryTestExpectations.json', 'utf-8') +); + +fs.writeFileSync( + source, + JSON.stringify([...testExpectations, ...canaryTestExpectations], null, 2) +);