Skip to content

Commit f44785c

Browse files
authored
build: Add codecov test analytics for playwright tests (#13654)
https://docs.codecov.com/docs/test-result-ingestion-beta https://playwright.dev/docs/test-reporters Adds codecov test analytics to the repo, specifically for our playwright tests. This works by using the junit reporter with playwright, and then uploading that via the `codecov/test-results-action@v1` GitHub Action.
1 parent e8a016e commit f44785c

File tree

10 files changed

+32
-7
lines changed

10 files changed

+32
-7
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,13 @@ jobs:
610610
overwrite: true
611611
retention-days: 7
612612

613+
- name: Upload test results to Codecov
614+
if: cancelled() == false
615+
uses: codecov/test-results-action@v1
616+
with:
617+
directory: dev-packages/browser-integration-tests
618+
token: ${{ secrets.CODECOV_TOKEN }}
619+
613620
job_browser_loader_tests:
614621
name: PW ${{ matrix.bundle }} Tests
615622
needs: [job_get_metadata, job_build]
@@ -653,6 +660,7 @@ jobs:
653660
run: |
654661
cd dev-packages/browser-integration-tests
655662
yarn test:loader
663+
656664
- name: Upload Playwright Traces
657665
uses: actions/upload-artifact@v4
658666
if: failure()
@@ -662,6 +670,13 @@ jobs:
662670
overwrite: true
663671
retention-days: 7
664672

673+
- name: Upload test results to Codecov
674+
if: cancelled() == false
675+
uses: codecov/test-results-action@v1
676+
with:
677+
directory: dev-packages/browser-integration-tests
678+
token: ${{ secrets.CODECOV_TOKEN }}
679+
665680
job_check_for_faulty_dts:
666681
name: Check for faulty .d.ts files
667682
needs: [job_get_metadata, job_build]
@@ -1013,6 +1028,13 @@ jobs:
10131028
overwrite: true
10141029
retention-days: 7
10151030

1031+
- name: Upload test results to Codecov
1032+
if: cancelled() == false
1033+
uses: codecov/test-results-action@v1
1034+
with:
1035+
directory: dev-packages/e2e-tests
1036+
token: ${{ secrets.CODECOV_TOKEN }}
1037+
10161038
job_optional_e2e_tests:
10171039
name: E2E ${{ matrix.label || matrix.test-application }} Test
10181040
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks

dev-packages/browser-integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"test:loader:replay_buffer": "PW_BUNDLE=loader_replay_buffer yarn test:loader",
3636
"test:loader:full": "PW_BUNDLE=loader_tracing_replay yarn test:loader",
3737
"test:loader:debug": "PW_BUNDLE=loader_debug yarn test:loader",
38-
"test:ci": "yarn test:all --reporter='line'",
38+
"test:ci": "yarn test:all",
3939
"test:update-snapshots": "yarn test:all --update-snapshots",
4040
"test:detect-flaky": "ts-node scripts/detectFlakyTests.ts"
4141
},

dev-packages/browser-integration-tests/playwright.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const config: PlaywrightTestConfig = {
3030
},
3131
],
3232

33+
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
34+
3335
globalSetup: require.resolve('./playwright.setup.ts'),
3436
globalTeardown: require.resolve('./playwright.teardown.ts'),
3537
};

dev-packages/e2e-tests/test-applications/ember-classic/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const config: PlaywrightTestConfig = {
3535
forbidOnly: !!process.env.CI,
3636
retries: 0,
3737
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
38-
reporter: 'list',
38+
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
3939
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
4040
use: {
4141
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */

dev-packages/e2e-tests/test-applications/ember-embroider/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const config: PlaywrightTestConfig = {
3535
forbidOnly: !!process.env.CI,
3636
retries: 0,
3737
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
38-
reporter: 'list',
38+
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
3939
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
4040
use: {
4141
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */

dev-packages/e2e-tests/test-applications/node-express-send-to-sentry/playwright.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const config = {
2323
/* Retry on CI only */
2424
retries: 0,
2525
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
26-
reporter: 'list',
26+
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
2727
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2828
use: {
2929
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */

dev-packages/e2e-tests/test-applications/react-send-to-sentry/playwright.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const config = {
2323
/* Opt out of parallel tests on CI. */
2424
workers: 1,
2525
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
26-
reporter: 'list',
26+
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
2727
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2828
use: {
2929
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */

dev-packages/test-utils/src/playwright-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function getPlaywrightConfig(
3737
/* In dev mode some apps are flaky, so we allow retry there... */
3838
retries: testEnv === 'development' ? 3 : 0,
3939
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
40-
reporter: process.env.CI ? 'line' : 'list',
40+
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
4141
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
4242
use: {
4343
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */

packages/remix/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"test:integration:prepare": "(cd test/integration && yarn install)",
107107
"test:integration:clean": "(cd test/integration && rimraf .cache node_modules build)",
108108
"test:integration:client": "yarn playwright install-deps && yarn playwright test test/integration/test/client/ --project='chromium'",
109-
"test:integration:client:ci": "yarn test:integration:client --reporter='line'",
109+
"test:integration:client:ci": "yarn test:integration:client",
110110
"test:integration:server": "export NODE_OPTIONS='--stack-trace-limit=25' && vitest run",
111111
"test:unit": "jest",
112112
"test:watch": "jest --watch",

packages/remix/playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const config: PlaywrightTestConfig = {
88
},
99
// Run tests inside of a single file in parallel
1010
fullyParallel: true,
11+
reporter: process.env.CI ? [['line'], ['junit', { outputFile: 'results.junit.xml' }]] : 'list',
1112
// Use 3 workers on CI, else use defaults (based on available CPU cores)
1213
// Note that 3 is a random number selected to work well with our CI setup
1314
workers: process.env.CI ? 3 : undefined,

0 commit comments

Comments
 (0)