From fe2641121f98c45f007585754fb05736de8c45d2 Mon Sep 17 00:00:00 2001 From: Anna Szczech Date: Thu, 16 Jan 2025 15:12:49 +0100 Subject: [PATCH] add steps for reporting --- .github/actions/merge-pw-reports/action.yml | 26 +++++++++++++++++ package-lock.json | 14 ++++++++++ package.json | 1 + playwright.config.ts | 31 +++++++++++---------- 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/.github/actions/merge-pw-reports/action.yml b/.github/actions/merge-pw-reports/action.yml index 46f2b1b56c7..a80800ef5eb 100644 --- a/.github/actions/merge-pw-reports/action.yml +++ b/.github/actions/merge-pw-reports/action.yml @@ -29,3 +29,29 @@ runs: name: html-report--attempt-${{ github.run_attempt }} path: playwright-report retention-days: 14 + + - name: Merge ctrf reports + shell: bash + run: npx ctrf merge ./ctrf --output merged-ctrf-report.json + + - name: Publish Test Report + uses: ctrf-io/github-test-reporter@v1 + with: + report-path: './ctrf/*.json' + summary-report: true + previous-results-report: true + failed-report: true + flaky-report: true + if: always() + + - name: Upload test results + uses: actions/upload-artifact@v4 + with: + name: ctrf-report + path: ctrf-reports/merged-ctrf-report.json + + - name: Upload test results + uses: actions/upload-artifact@v4 + with: + name: custom-artifact-name + path: ctrf-reports/ctrf-report-no-fails.json \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 11c69bd7d6a..952051683fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -147,6 +147,7 @@ "mochawesome": "^7.1.3", "mochawesome-merge": "^4.3.0", "mochawesome-report-generator": "^6.2.0", + "playwright-ctrf-json-reporter": "^0.0.18", "playwright-testmo-reporter": "^1.8.4", "rollup-plugin-polyfill-node": "^0.11.0", "typescript": "^5.0.4", @@ -17946,6 +17947,13 @@ "node": ">=18" } }, + "node_modules/playwright-ctrf-json-reporter": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/playwright-ctrf-json-reporter/-/playwright-ctrf-json-reporter-0.0.18.tgz", + "integrity": "sha512-AjFNpIMKI8zeyaktA2LBphYzy3ffiBjXobBXxEfrVUDov/Z8v5+y9FI0m3cBCr8yauk2brN+Er225vHsZDIu0g==", + "dev": true, + "license": "MIT" + }, "node_modules/playwright-testmo-reporter": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/playwright-testmo-reporter/-/playwright-testmo-reporter-1.11.0.tgz", @@ -33736,6 +33744,12 @@ "integrity": "sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA==", "dev": true }, + "playwright-ctrf-json-reporter": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/playwright-ctrf-json-reporter/-/playwright-ctrf-json-reporter-0.0.18.tgz", + "integrity": "sha512-AjFNpIMKI8zeyaktA2LBphYzy3ffiBjXobBXxEfrVUDov/Z8v5+y9FI0m3cBCr8yauk2brN+Er225vHsZDIu0g==", + "dev": true + }, "playwright-testmo-reporter": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/playwright-testmo-reporter/-/playwright-testmo-reporter-1.11.0.tgz", diff --git a/package.json b/package.json index 4d77f5bf6ad..1d46ae8fa28 100644 --- a/package.json +++ b/package.json @@ -155,6 +155,7 @@ "mochawesome": "^7.1.3", "mochawesome-merge": "^4.3.0", "mochawesome-report-generator": "^6.2.0", + "playwright-ctrf-json-reporter": "^0.0.18", "playwright-testmo-reporter": "^1.8.4", "rollup-plugin-polyfill-node": "^0.11.0", "typescript": "^5.0.4", diff --git a/playwright.config.ts b/playwright.config.ts index 44fdf6cbace..019ee224192 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -23,21 +23,22 @@ export default defineConfig({ workers: parseInt(env.WORKERS || DEFAULT_WORKERS), reporter: process.env.CI ? [ - ["blob"], - ["github"], - [ - "playwright-testmo-reporter", - { - outputFile: "testmo/testmo.xml", // Optional: Output file path. Defaults to 'testmo.xml'. - embedBrowserType: true, // Optional: Embed browser type in the XML file. Defaults to false. - embedTestSteps: true, // Optional: Embed test steps in the XML file. Defaults to true. - testStepCategories: ["hook", "expect", "pw:api", "test.step"], // Optional: Test step categories to include in the XML file. Defaults to ["hook","expect","pw:api","test.step"]. Possible options are "hook", "expect", "pw:api", "test.step". - testTitleDepth: 1, // Optional: Test case title depth to report in the XML file. Defaults to 1. Increase this to 2 include suite name. Increase this even further to include the path. - attachmentBasePathCallback: () => - process.env.URL_TO_RUN ? process.env.URL_TO_RUN : "", - }, - ], - ] + ["blob"], + ["github"], + [ + "playwright-testmo-reporter", + { + outputFile: "testmo/testmo.xml", // Optional: Output file path. Defaults to 'testmo.xml'. + embedBrowserType: true, // Optional: Embed browser type in the XML file. Defaults to false. + embedTestSteps: true, // Optional: Embed test steps in the XML file. Defaults to true. + testStepCategories: ["hook", "expect", "pw:api", "test.step"], // Optional: Test step categories to include in the XML file. Defaults to ["hook","expect","pw:api","test.step"]. Possible options are "hook", "expect", "pw:api", "test.step". + testTitleDepth: 1, // Optional: Test case title depth to report in the XML file. Defaults to 1. Increase this to 2 include suite name. Increase this even further to include the path. + attachmentBasePathCallback: () => + process.env.URL_TO_RUN ? process.env.URL_TO_RUN : "", + }, + ], + ["playwright-ctrf-json-reporter", {}] + ] : [["html"], ["list"]], expect: { timeout: 10 * 1000 }, maxFailures: 10,