From 732a400ebee23971288a169e029406f594d4c799 Mon Sep 17 00:00:00 2001 From: Andrew Goldis Date: Wed, 18 Dec 2024 01:08:51 -0800 Subject: [PATCH] chore: summary example --- .../{workflows => backup}/argos-example.yml | 0 .../rerun-shards-pwc.yml | 0 .../rerun-shards-reporter.yml | 0 .github/{workflows => backup}/reruns-or8n.yml | 0 .../{workflows => backup}/test-basic-pwc.yml | 0 .github/backup/test-basic-reporter.yml | 47 +++++++++++++++++++ .github/{workflows => backup}/test-or8n.yml | 0 .github/workflows/test-basic-reporter.yml | 6 +-- basic/playwright.config.reporter.ts | 10 +++- basic/pw.config.shared.ts | 6 +-- 10 files changed, 62 insertions(+), 7 deletions(-) rename .github/{workflows => backup}/argos-example.yml (100%) rename .github/{workflows => backup}/rerun-shards-pwc.yml (100%) rename .github/{workflows => backup}/rerun-shards-reporter.yml (100%) rename .github/{workflows => backup}/reruns-or8n.yml (100%) rename .github/{workflows => backup}/test-basic-pwc.yml (100%) create mode 100644 .github/backup/test-basic-reporter.yml rename .github/{workflows => backup}/test-or8n.yml (100%) diff --git a/.github/workflows/argos-example.yml b/.github/backup/argos-example.yml similarity index 100% rename from .github/workflows/argos-example.yml rename to .github/backup/argos-example.yml diff --git a/.github/workflows/rerun-shards-pwc.yml b/.github/backup/rerun-shards-pwc.yml similarity index 100% rename from .github/workflows/rerun-shards-pwc.yml rename to .github/backup/rerun-shards-pwc.yml diff --git a/.github/workflows/rerun-shards-reporter.yml b/.github/backup/rerun-shards-reporter.yml similarity index 100% rename from .github/workflows/rerun-shards-reporter.yml rename to .github/backup/rerun-shards-reporter.yml diff --git a/.github/workflows/reruns-or8n.yml b/.github/backup/reruns-or8n.yml similarity index 100% rename from .github/workflows/reruns-or8n.yml rename to .github/backup/reruns-or8n.yml diff --git a/.github/workflows/test-basic-pwc.yml b/.github/backup/test-basic-pwc.yml similarity index 100% rename from .github/workflows/test-basic-pwc.yml rename to .github/backup/test-basic-pwc.yml diff --git a/.github/backup/test-basic-reporter.yml b/.github/backup/test-basic-reporter.yml new file mode 100644 index 0000000..0712a7a --- /dev/null +++ b/.github/backup/test-basic-reporter.yml @@ -0,0 +1,47 @@ +name: demo.playwright.reporter +on: + workflow_dispatch: + pull_request: + branches: [main] + push: + branches: [main] +jobs: + basicTests: + strategy: + fail-fast: false + matrix: + # run 3 copies of the current job in parallel + shard: [1, 2, 3] + name: "Playwright Tests - Reporter" + timeout-minutes: 60 + runs-on: ubuntu-22.04 + container: mcr.microsoft.com/playwright:v1.49.0-jammy + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + # https://github.com/actions/runner-images/issues/6775 + - run: | + echo "$GITHUB_WORKSPACE" + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - uses: actions/setup-node@v4 + with: + node-version: "18.x" + + - name: Install dependencies + run: | + npm ci + npx playwright install chrome + + - name: Run Basic Tests + continue-on-error: false + working-directory: ./basic + env: + CURRENTS_PROJECT_ID: bnsqNa + CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }} + CURRENTS_CI_BUILD_ID: reporter-${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }} + run: | + npx playwright test --shard=${{ matrix.shard }}/${{ strategy.job-total }} --config ./playwright.config.reporter.ts diff --git a/.github/workflows/test-or8n.yml b/.github/backup/test-or8n.yml similarity index 100% rename from .github/workflows/test-or8n.yml rename to .github/backup/test-or8n.yml diff --git a/.github/workflows/test-basic-reporter.yml b/.github/workflows/test-basic-reporter.yml index 0712a7a..34695f8 100644 --- a/.github/workflows/test-basic-reporter.yml +++ b/.github/workflows/test-basic-reporter.yml @@ -1,4 +1,4 @@ -name: demo.playwright.reporter +name: demo.playwright.reporter-summary on: workflow_dispatch: pull_request: @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: # run 3 copies of the current job in parallel - shard: [1, 2, 3] + shard: [1, 2] name: "Playwright Tests - Reporter" timeout-minutes: 60 runs-on: ubuntu-22.04 @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: "18.x" + node-version: "20.x" - name: Install dependencies run: | diff --git a/basic/playwright.config.reporter.ts b/basic/playwright.config.reporter.ts index 98f080a..afe2dc4 100644 --- a/basic/playwright.config.reporter.ts +++ b/basic/playwright.config.reporter.ts @@ -1,2 +1,10 @@ +import { CurrentsConfig, currentsReporter } from "@currents/playwright"; import config from "./pw.config.shared"; -export default { ...config, reporter: [["@currents/playwright"]] }; + +const currentsConfig: CurrentsConfig = { + recordKey: process.env.CURRENTS_RECORD_KEY ?? "", + projectId: process.env.CURRENTS_PROJECT_ID ?? "", + outputFile: ".currents-report.json", +}; + +export default { ...config, reporter: [currentsReporter(currentsConfig)] }; diff --git a/basic/pw.config.shared.ts b/basic/pw.config.shared.ts index 7a89377..4ec620b 100644 --- a/basic/pw.config.shared.ts +++ b/basic/pw.config.shared.ts @@ -41,11 +41,11 @@ const config = defineConfig({ ], webServer: { - command: 'node ./server/index.js', + command: "node ./server/index.js", port: 4346, reuseExistingServer: !process.env.CI, - stdout: 'ignore', - stderr: 'pipe', + stdout: "ignore", + stderr: "pipe", }, /* Folder for test artifacts such as screenshots, videos, traces, etc. */