Repository navigation
181 lines (178 loc) · 6.04 KB
/
Copy pathtest_e2e_be.yml
File metadata and controls
181 lines (178 loc) · 6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: test_e2e_be
on:
workflow_call:
inputs:
name:
description: Test suite name
type: string
required: false
default: "BE E2E"
id:
description: Test suite ID
type: string
required: false
default: ""
be_url:
description: The backend URL for testing
type: string
required: true
default: ""
project:
description: Lagoon project name
type: string
required: true
default: ""
test_type:
type: string
required: false
default: ':e2e:'
test_subtype:
type: string
required: false
default: ''
runner:
type: string
required: false
default: biggy-automated-testing
tag:
description: SDP testing Docker image tag
type: string
required: false
default: ""
tags:
description: Tags for filtering the tests
type: string
required: false
default: ""
slack_channel:
type: string
required: false
default: "sdp-test-report"
slack_notify:
description: When to send the Slack notifications
type: string
required: false
default: "release_only"
test_status:
type: boolean
default: false
env:
# Test users
TEST_HTTP_AUTH_USER: ${{ secrets.TEST_HTTP_AUTH_USER }}
TEST_HTTP_AUTH_PASS: ${{ secrets.TEST_HTTP_AUTH_PASS }}
TEST_BE_ADMIN_USER: ${{ secrets.TEST_BE_ADMIN_USER }}
TEST_BE_ADMIN_PASS: ${{ secrets.TEST_BE_ADMIN_PASS }}
TEST_BE_SITE_ADMIN_USER: ${{ secrets.TEST_BE_SITE_ADMIN_USER }}
TEST_BE_SITE_ADMIN_PASS: ${{ secrets.TEST_BE_SITE_ADMIN_PASS }}
TEST_BE_EDITOR_USER: ${{ secrets.TEST_BE_EDITOR_USER }}
TEST_BE_EDITOR_PASS: ${{ secrets.TEST_BE_EDITOR_PASS }}
##TODO: Add to secrets
# TEST_BE_APPROVER_PLUS_USER: ${{ secrets.TEST_BE_APPROVER_PLUS_USER }}
# TEST_BE_APPROVER_PLUS_PASS: ${{ secrets.TEST_BE_APPROVER_PLUS_PASS }}
# TEST_BE_DATAIMPORTER_USER: ${{ secrets.TEST_BE_DATAIMPORTER_USER }}
# TEST_BE_DATAIMPORTER_PASS: ${{ secrets.TEST_BE_DATAIMPORTER_PASS }}
TEST_BE_APPROVER_USER: ${{ secrets.TEST_BE_APPROVER_USER }}
TEST_BE_APPROVER_PASS: ${{ secrets.TEST_BE_APPROVER_PASS }}
TEST_BE_PREVIEWER_USER: ${{ secrets.TEST_BE_PREVIEWER_USER }}
TEST_BE_PREVIEWER_PASS: ${{ secrets.TEST_BE_PREVIEWER_PASS }}
TEST_BE_CONTRIBUTOR_USER: ${{ secrets.TEST_BE_CONTRIBUTOR_USER }}
TEST_BE_CONTRIBUTOR_PASS: ${{ secrets.TEST_BE_CONTRIBUTOR_PASS }}
TEST_APPLITOOLS_API_KEY: ${{ secrets.TEST_APPLITOOLS_API_KEY }}
# Project secrets
TEST_PREMIER_MAILGUN_DEV_TOKEN: ${{ secrets.TEST_PREMIER_MAILGUN_DEV_TOKEN }}
# Keys
TEST_FTP_JIRA_EMAIL: ${{ secrets.TEST_FTP_JIRA_EMAIL }}
TEST_FTP_JIRA_API_TOKEN: ${{ secrets.TEST_FTP_JIRA_API_TOKEN }}
# Settings
DD_API_KEY: ${{ secrets.TEST_DD_API_KEY }}
DD_ENV: ci
DD_SERVICE: sdp-testing-playwright
DD_SITE: ap2.datadoghq.com
DD_CIVISIBILITY_AGENTLESS_ENABLED: 'true'
DD_CIVISIBILITY_GIT_UPLOAD_ENABLED: 'false'
jobs:
test_e2e_be:
name: test_e2e_be
runs-on: ${{ inputs.runner }}
defaults:
run:
working-directory: /app
container:
image: ghcr.io/${{ github.repository_owner }}/sdp-testing-playwright:${{ inputs.tag }}
credentials:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
steps:
-
name: Set up Environment variables
run: |
echo 'TEST_BE_BASE_URL=${{ inputs.be_url }}' >> $GITHUB_ENV
echo 'TEST_PROJECT=${{ inputs.project }}' >> $GITHUB_ENV
-
name: Check test environment urls
run: |
echo $TEST_BE_BASE_URL
echo $TEST_PROJECT
-
name: "Wait up servers in case they are idle"
run: |
curl ${TEST_BE_BASE_URL} -s -S --max-time 1000 --write-out '%{http_code}' --output /dev/null;
-
name: Enable Datadog tracing if available
id: dd_trace_check
shell: bash
run: |
if node -e "require.resolve('dd-trace/ci/init')" 2>/dev/null; then
echo "dd-trace is available; enabling Datadog tracing"
echo "node_options=-r dd-trace/ci/init" >> "$GITHUB_OUTPUT"
else
echo "dd-trace not available; continuing without Datadog tracing"
echo "node_options=" >> "$GITHUB_OUTPUT"
fi
-
name: Run Backend tests
run: |
npm run e2e:backend -- -g "${{ inputs.tags }}"
env:
NODE_OPTIONS: ${{ steps.dd_trace_check.outputs.node_options }}
- uses: actions/upload-artifact@v6
if: ${{ !cancelled() }}
with:
name: playwright-report-backend
path: /app/playwright-report/
retention-days: 30
- name: Publish Test Report (summary-report)
uses: ctrf-io/github-test-reporter@v1
with:
report-path: '/app/ctrf/*.json'
summary-report: true
if: always()
- name: Publish Test Report (file-report)
uses: ctrf-io/github-test-reporter@v1
with:
report-path: '/app/ctrf/*.json'
file-report: true
if: always()
notify_slack:
uses: ./.github/workflows/notify_slack.yml
if: |
always() &&
( inputs.slack_notify == 'always' ||
( inputs.slack_notify == 'release_only' &&
( startsWith(github.ref_name, 'release/') ||
contains(fromJSON('["uat", "master", "standby", "production"]'), github.ref_name)
)
)
)
needs: [test_e2e_be]
secrets: inherit
with:
workflow_name: ${{ inputs.name }}
workflow_id: ${{ inputs.id }}
workflow_reusable_name: "test_e2e_be"
test_type: ${{ inputs.test_type }}
test_subtype: ${{ inputs.test_subtype }}
artifact_name: "playwright-report-backend"
be_url: ${{ inputs.be_url }}
project: ${{ inputs.project }}
slack_channel: ${{ inputs.slack_channel }}