Skip to content

Commit cf73a0e

Browse files
authored
Merge pull request #46 from currents-dev/example/summary
..
2 parents efa6708 + c1693df commit cf73a0e

File tree

8 files changed

+79
-545
lines changed

8 files changed

+79
-545
lines changed

.github/test.yml

Lines changed: 0 additions & 517 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: demo.playwright.reporter-with-summary
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
jobs:
9+
basicTests:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
# run 3 copies of the current job in parallel
14+
shard: [1, 2]
15+
name: "Playwright Tests - Reporter"
16+
timeout-minutes: 5
17+
runs-on: ubuntu-22.04
18+
container: mcr.microsoft.com/playwright:v1.49.0-jammy
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.event.pull_request.head.sha }}
24+
25+
# https://github.com/actions/runner-images/issues/6775
26+
- run: |
27+
echo "$GITHUB_WORKSPACE"
28+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
29+
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: "20.x"
33+
34+
- name: Install dependencies
35+
run: |
36+
npm ci
37+
npx playwright install chrome
38+
39+
- name: Run Basic Tests
40+
continue-on-error: true
41+
working-directory: ./basic
42+
env:
43+
CURRENTS_PROJECT_ID: bnsqNa
44+
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
45+
CURRENTS_CI_BUILD_ID: reporter-${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
46+
run: |
47+
npx playwright test --shard=${{ matrix.shard }}/${{ strategy.job-total }} --config ./playwright.config.reporter.ts --grep @basic
48+
49+
- name: Show Summary
50+
working-directory: ./basic
51+
run: |
52+
cat currents-report.json

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Examples of various variants of integrating Currents with Playwright on GitHub A
2323

2424
- [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`.
2525

26+
- [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.
27+
2628
- [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.
2729

2830
- [argos-example.yml](.github/workflows/argos-example.yml) - parallel run using Argos CI and Currents orchestration.
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1+
import { CurrentsConfig, currentsReporter } from "@currents/playwright";
12
import config from "./pw.config.shared";
2-
export default { ...config, reporter: [["@currents/playwright"]] };
3+
4+
const currentsConfig: CurrentsConfig = {
5+
projectId: process.env.CURRENTS_PROJECT_ID ?? "xx",
6+
recordKey: process.env.CURRENTS_RECORD_KEY ?? "yy",
7+
outputFile: "currents-report.json",
8+
};
9+
10+
export default { ...config, reporter: [currentsReporter(currentsConfig)] };

currents.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
import { CurrentsConfig } from "@currents/playwright";
22

33
const config: CurrentsConfig = {
4-
projectId: "mdXsz8",
5-
recordKey: "KPEvZL0LDYzcZH3U",
4+
projectId: process.env.CURRENTS_PROJECT_ID ?? "xx",
5+
recordKey: process.env.CURRENTS_RECORD_KEY ?? "yy",
66
ciBuildId: Date.now().toString(),
7+
outputFile: "currents-report.json",
78
orchestration: {
89
skipReporterInjection: true,
910
onFinish: async () => {
1011
try {
1112
const execa = await import("execa");
13+
1214
const resultUpload = await execa("npx", [
1315
"argos",
1416
"upload",
1517
"./screenshots",
1618
]);
1719
console.log(resultUpload);
20+
1821
const resultFinalize = await execa("npx", ["argos", "finalize"]);
1922
console.log(resultFinalize);
2023
} catch (e) {

ddd

Whitespace-only changes.

package-lock.json

Lines changed: 10 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@argos-ci/cli": "^2.4.3",
1414
"@argos-ci/playwright": "^3.6.1",
1515
"@axe-core/playwright": "^4.4.4",
16-
"@currents/playwright": "^1.9.0-beta.2",
16+
"@currents/playwright": "^1.9.0",
1717
"@playwright/test": "^1.49.0",
1818
"@types/express": "^4.17.13",
1919
"@typescript-eslint/eslint-plugin": "^5.22.0",

0 commit comments

Comments
 (0)