Skip to content
Merged

.. #46

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
517 changes: 0 additions & 517 deletions .github/test.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/test-basic-reporter-with-summary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: demo.playwright.reporter-with-summary
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]
name: "Playwright Tests - Reporter"
timeout-minutes: 5
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: "20.x"

- name: Install dependencies
run: |
npm ci
npx playwright install chrome

- name: Run Basic Tests
continue-on-error: true
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 --grep @basic

- name: Show Summary
working-directory: ./basic
run: |
cat currents-report.json
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Examples of various variants of integrating Currents with Playwright on GitHub A

- [test-basic-reporter.yml](.github/workflows/test-basic-reporter.yml) - parallel run using 3 shards and `playwright.config.ts`. Basic example of running playwright tests in parallel using 3 containers of GitHub Actions Matrix configuring Currents Reporter in `playwright.config.ts`.

- [test-basic-reporter-with-summary.yml](.github/workflows/test-basic-reporter-with-summary.yml) - parallel run using 2 shards and `playwright.config.ts` prints summary at the end of a run for each shard.

- [test-or8n.yml](.github/workflows/test-or8n.yml) - parallel Playwright Tests using [Currents Orchestration for Playwright](https://docs.currents.dev/guides/parallelization-guide/pw-parallelization/playwright-orchestration) - and GitHub Actions Matrix. Currents Orchestration speeds up CI runs by up to 40% (compared to native sharding) by optimally balancing tests between the available machines.

- [argos-example.yml](.github/workflows/argos-example.yml) - parallel run using Argos CI and Currents orchestration.
Expand Down
10 changes: 9 additions & 1 deletion basic/playwright.config.reporter.ts
Original file line number Diff line number Diff line change
@@ -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 = {
projectId: process.env.CURRENTS_PROJECT_ID ?? "xx",
recordKey: process.env.CURRENTS_RECORD_KEY ?? "yy",
outputFile: "currents-report.json",
};

export default { ...config, reporter: [currentsReporter(currentsConfig)] };
7 changes: 5 additions & 2 deletions currents.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import { CurrentsConfig } from "@currents/playwright";

const config: CurrentsConfig = {
projectId: "mdXsz8",
recordKey: "KPEvZL0LDYzcZH3U",
projectId: process.env.CURRENTS_PROJECT_ID ?? "xx",
recordKey: process.env.CURRENTS_RECORD_KEY ?? "yy",
ciBuildId: Date.now().toString(),
outputFile: "currents-report.json",
orchestration: {
skipReporterInjection: true,
onFinish: async () => {
try {
const execa = await import("execa");

const resultUpload = await execa("npx", [
"argos",
"upload",
"./screenshots",
]);
console.log(resultUpload);

const resultFinalize = await execa("npx", ["argos", "finalize"]);
console.log(resultFinalize);
} catch (e) {
Expand Down
Empty file removed ddd
Empty file.
34 changes: 10 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@argos-ci/cli": "^2.4.3",
"@argos-ci/playwright": "^3.6.1",
"@axe-core/playwright": "^4.4.4",
"@currents/playwright": "^1.9.0-beta.2",
"@currents/playwright": "^1.9.0",
"@playwright/test": "^1.49.0",
"@types/express": "^4.17.13",
"@typescript-eslint/eslint-plugin": "^5.22.0",
Expand Down
Loading