[e2e tests] Fix e2e test results path and report name (#48320)

* Fix the report name sent to woocommerce-test-reports workflow

* Add test type

* Test change

* Remove test type

* Merge artifacts to keep allure-results

* Overwrite artifacts if one already exists with the same name

* Test changes to trigger tests

* Fix allure-results and .state paths

* Filter tests for faster feedback

* Debug artifacts content

* Use name instead of pattern

* Use name instead of pattern

* Don't use an intermediate path

* Use artifact name and path instead of only pattern

* Use artifact name and path instead of only pattern

* Use artifact name and path instead of only pattern

* Remove testMatch filter to run all tests

* Revert test change

* Add changelog
This commit is contained in:
Adrian Moldovan 2024-06-10 21:21:46 +03:00 committed by GitHub
parent cd0884a294
commit 1533afdca3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 13 deletions

View File

@ -255,7 +255,7 @@ jobs:
pnpm utils slack-test-report -c "${{ needs.project-test-jobs.result }}" -r "$CHECKS_TYPE Tests" -m "$COMMIT_MESSAGE" pnpm utils slack-test-report -c "${{ needs.project-test-jobs.result }}" -r "$CHECKS_TYPE Tests" -m "$COMMIT_MESSAGE"
test-reports: test-reports:
name: 'Publish reports - ${{ matrix.report }}' name: 'Test reports - ${{ matrix.report }}'
needs: needs:
[ [
'project-jobs', 'project-jobs',
@ -276,37 +276,48 @@ jobs:
DESTINATION_PATH: ../ DESTINATION_PATH: ../
run: ./.github/workflows/scripts/install-allure.sh run: ./.github/workflows/scripts/install-allure.sh
- name: 'Download blob reports from artifacts' - name: 'Merge artifacts'
uses: actions/upload-artifact/merge@v4
continue-on-error: true
with:
name: ${{ matrix.report }}
pattern: ${{ matrix.report }}-*
delete-merged: true
- name: 'Download merged artifacts'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: ${{ matrix.report }}
path: ./out path: ./out
pattern: ${{ matrix.report }}-*
run-id: project-test-jobs
merge-multiple: true
- name: 'Generate Allure report' - name: 'Generate Allure report'
id: generate_allure_report id: generate_allure_report
run: allure generate --clean ./out/allure-results --output ./out/allure-report run: |
ls -lh ./out
allure generate --clean ./out/allure-results --output ./out/allure-report
ls -lh ./out
- name: 'Archive reports' - name: 'Re-upload artifacts with generated report'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ matrix.report }} name: ${{ matrix.report }}
path: ./out path: ./out
if-no-files-found: ignore if-no-files-found: ignore
retention-days: 5 retention-days: 10
overwrite: true
- name: 'Publish report to dashboard' - name: 'Publish report to dashboard'
env: env:
GH_TOKEN: ${{ secrets.REPORTS_TOKEN }} GH_TOKEN: ${{ secrets.REPORTS_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }} PR_NUMBER: ${{ github.event.pull_request.number }}
RUN_ID: ${{ github.run_id }} RUN_ID: ${{ github.run_id }}
REPORT_NAME: ${{ matrix.report }}
if: ${{ contains(matrix.report, 'e2e') }} # temporary until we adapt the woocommerce-test-reports side to not care about the test type if: ${{ contains(matrix.report, 'e2e') }} # temporary until we adapt the woocommerce-test-reports side to not care about the test type
run: | run: |
if [ "$GITHUB_EVENT_NAME" == pull_request ]; then if [ "$GITHUB_EVENT_NAME" == pull_request ]; then
gh workflow run publish-test-reports-pr.yml \ gh workflow run publish-test-reports-pr.yml \
-f run_id=$RUN_ID \ -f run_id=$RUN_ID \
-f e2e_artifact=e2e-test-report \ -f e2e_artifact=$REPORT_NAME \
-f pr_number=$PR_NUMBER \ -f pr_number=$PR_NUMBER \
-f commit_sha=$GITHUB_SHA \ -f commit_sha=$GITHUB_SHA \
-f s3_root=public \ -f s3_root=public \
@ -314,7 +325,7 @@ jobs:
elif [ "$GITHUB_EVENT_NAME" == push ]; then elif [ "$GITHUB_EVENT_NAME" == push ]; then
gh workflow run publish-test-reports-trunk-merge.yml \ gh workflow run publish-test-reports-trunk-merge.yml \
-f run_id=$RUN_ID \ -f run_id=$RUN_ID \
-f artifact=e2e-test-report \ -f artifact=$REPORT_NAME \
-f pr_number=$PR_NUMBER \ -f pr_number=$PR_NUMBER \
-f commit_sha=$GITHUB_SHA \ -f commit_sha=$GITHUB_SHA \
-f test_type="e2e" \ -f test_type="e2e" \
@ -324,6 +335,6 @@ jobs:
fi fi
- name: 'Add annotation to workflow run linking to PR' - name: 'Add annotation to workflow run linking to PR'
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' && contains(matrix.report, 'e2e') }}
run: | run: |
echo "::notice::🔗🔗 The e2e report for this run is available at https://woocommerce.github.io/woocommerce-test-reports/pr/${{ github.event.pull_request.number }}/e2e" echo "::notice::🔗🔗 The e2e report for this run is available at https://woocommerce.github.io/woocommerce-test-reports/pr/${{ github.event.pull_request.number }}/e2e"

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
[e2e tests] Fix e2e test reports paths

View File

@ -18,7 +18,7 @@ const reporter = [
{ {
outputFolder: outputFolder:
ALLURE_RESULTS_DIR ?? ALLURE_RESULTS_DIR ??
`${ testsRootPath }/tests/e2e-pw/test-results/allure-results`, `${ testsRootPath }/test-results/allure-results`,
detail: true, detail: true,
suiteTitle: true, suiteTitle: true,
}, },
@ -65,7 +65,7 @@ const config = {
use: { use: {
baseURL: BASE_URL ?? 'http://localhost:8086', baseURL: BASE_URL ?? 'http://localhost:8086',
screenshot: { mode: 'only-on-failure', fullPage: true }, screenshot: { mode: 'only-on-failure', fullPage: true },
stateDir: `${ testsRootPath }/tests/e2e-pw/.state/`, stateDir: `${ testsRootPath }/.state/`,
trace: 'retain-on-failure', trace: 'retain-on-failure',
video: 'retain-on-failure', video: 'retain-on-failure',
viewport: { width: 1280, height: 720 }, viewport: { width: 1280, height: 720 },