1414 required : true
1515 args :
1616 type : string
17- description : Additional arguments to testcafe
17+ description : Additional arguments to playwright
1818 required : false
1919 default : ' '
2020 concurrency :
4444 contents : read
4545 packages : read
4646 id-token : write
47+ pull-requests : write
4748
4849 env :
4950 GCR_TOKEN : ${{ secrets.GCR_TOKEN }}
5253 - name : Cloning repo
5354 uses : actions/checkout@v5
5455
56+ - name : Determine test type
57+ id : test-type
58+ run : |
59+ if [[ '${{ inputs.args }}' == *"@enterprise"* ]]; then
60+ echo "type=private-cloud" >> $GITHUB_OUTPUT
61+ echo "label=private-cloud" >> $GITHUB_OUTPUT
62+ else
63+ echo "type=oss" >> $GITHUB_OUTPUT
64+ echo "label=oss" >> $GITHUB_OUTPUT
65+ fi
66+
5567 - name : Login to Github Container Registry
5668 if : ${{ env.GCR_TOKEN }}
5769 uses : docker/login-action@v3
@@ -67,22 +79,89 @@ jobs:
6779 run : depot pull-token | docker login -u x-token --password-stdin registry.depot.dev
6880
6981 - name : Run tests on dockerised frontend
70- uses : nick-fields/retry@v3
71- with :
72- shell : bash
73- command : |
74- cd frontend
75- make test
76- max_attempts : 2
77- retry_on : error
78- timeout_minutes : 20
79- on_retry_command : |
80- cd frontend
81- docker compose down --remove-orphans || true
82+ working-directory : frontend
83+ run : make test
8284 env :
8385 opts : ${{ inputs.args }}
8486 API_IMAGE : ${{ inputs.api-image }}
8587 E2E_IMAGE : ${{ inputs.e2e-image }}
8688 E2E_CONCURRENCY : ${{ inputs.concurrency }}
89+ E2E_RETRIES : 2
8790 SLACK_TOKEN : ${{ secrets.SLACK_TOKEN }}
8891 GITHUB_ACTION_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
92+ timeout-minutes : 20
93+
94+ - name : Cleanup E2E services
95+ if : always()
96+ working-directory : frontend
97+ run : docker compose down --remove-orphans || true
98+
99+ - name : Copy results.json to HTML report
100+ if : always()
101+ run : |
102+ cp frontend/e2e/test-results/results.json frontend/e2e/playwright-report/ || true
103+
104+ - name : Upload HTML report
105+ if : failure()
106+ uses : actions/upload-artifact@v4
107+ with :
108+ name : playwright-html-report-${{ steps.test-type.outputs.type }}-${{ github.run_id }}-${{ github.run_attempt }}-${{ strategy.job-index }}
109+ path : frontend/e2e/playwright-report/
110+ retention-days : 30
111+ if-no-files-found : warn
112+
113+ - name : Set artifact URL
114+ if : failure() && github.event_name == 'pull_request'
115+ id : artifact-url
116+ run : |
117+ echo "url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts" >> $GITHUB_OUTPUT
118+
119+ - name : Send Slack notification and upload report
120+ if : failure()
121+ working-directory : frontend
122+ run : |
123+ cd e2e
124+ zip -r playwright-report.zip playwright-report/ || echo "Failed to zip report"
125+ cd ..
126+ npm install --no-save @slack/web-api
127+ npx -y tsx e2e/slack-e2e-reporter.ts
128+ env :
129+ SLACK_TOKEN : ${{ secrets.SLACK_TOKEN }}
130+ GITHUB_ACTION_URL : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
131+ GITHUB_REF_NAME : ${{ github.ref_name }}
132+ GITHUB_HEAD_REF : ${{ github.head_ref }}
133+ TEST_TYPE : ${{ steps.test-type.outputs.label }}
134+ PR_NUMBER : ${{ github.event.pull_request.number }}
135+ PR_TITLE : ${{ github.event.pull_request.title }}
136+ PR_URL : ${{ github.event.pull_request.html_url }}
137+
138+ - name : Generate test report summary (success)
139+ id : report-summary-success
140+ if : success() && github.event_name == 'pull_request'
141+ uses : daun/playwright-report-summary@v3
142+ with :
143+ report-file : frontend/e2e/playwright-report/results.json
144+ comment-title : ' Playwright Test Results (${{ steps.test-type.outputs.label }} - ${{ inputs.runs-on }})'
145+ create-comment : false
146+ custom-info : |
147+ **🔄 Run:** [#${{ github.run_number }} (attempt ${{ github.run_attempt }})](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
148+
149+ - name : Generate test report summary (failure)
150+ id : report-summary-failure
151+ if : failure() && github.event_name == 'pull_request'
152+ uses : daun/playwright-report-summary@v3
153+ with :
154+ report-file : frontend/e2e/playwright-report/results.json
155+ comment-title : ' Playwright Test Results (${{ steps.test-type.outputs.label }} - ${{ inputs.runs-on }})'
156+ create-comment : false
157+ custom-info : |
158+ **📦 Artifacts:** [View test results and HTML report](${{ steps.artifact-url.outputs.url }})
159+ **🔄 Run:** [#${{ github.run_number }} (attempt ${{ github.run_attempt }})](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
160+
161+ - name : Comment PR with test results
162+ if : always() && github.event_name == 'pull_request' && (steps.report-summary-success.outputs.summary || steps.report-summary-failure.outputs.summary)
163+ uses : marocchino/sticky-pull-request-comment@v2
164+ with :
165+ header : playwright-e2e-results
166+ append : true
167+ message : ${{ steps.report-summary-success.outputs.summary || steps.report-summary-failure.outputs.summary }}
0 commit comments