-
Notifications
You must be signed in to change notification settings - Fork 1.1k
146 lines (129 loc) · 4.85 KB
/
run-test-manual.yml
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
name: Run test manually
run-name: Run cypress tests
on:
workflow_dispatch:
inputs:
tags:
required: true
description: "Select tests to run"
default: "@allEnv"
type: choice
options:
- "@allEnv"
- "@critical"
- "@stable"
- "@oldRelease"
browser:
required: true
description: "Browser"
default: "electron"
type: choice
options:
- electron
- firefox
- all
jobs:
testmo-report-preparation:
runs-on: ubuntu-22.04
outputs:
TESTMO_RUN_ID: ${{ steps.init-testmo.outputs.testmo-run-id }}
BASE_URL: ${{ steps.set_variables.outputs.BASE_URL }}
API_URL: ${{ steps.set_variables.outputs.API_URL }}
steps:
- uses: actions/checkout@v4
- name: Set variables
id: set_variables
run: |
CURRENT_BRANCH=$(echo "${GITHUB_REF}" | sed "s/refs\/heads\///")
VERSION_SLUG=$(echo "${CURRENT_BRANCH}" | sed "s/\.//")
echo "BASE_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/dashboard/" >> $GITHUB_OUTPUT
echo "API_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT
- uses: ./.github/actions/testmo/testmo-init
with:
testmoUrl: ${{ secrets.TESTMO_URL }}
testmoToken: ${{ secrets.TESTMO_TOKEN }}
testmoRunName: "Cypress run ${{ github.ref_name }}"
id: init-testmo
run-tests-in-parallel:
needs: testmo-report-preparation
runs-on: ubuntu-22.04
container:
image: cypress/browsers:node18.12.0-chrome106-ff106
options: --user 1001
env:
GREP_TAGS: ${{ github.event.inputs.tags || '@critical'}}
BROWSER: ${{ inputs.browser || 'electron' }}
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6]
steps:
- uses: actions/checkout@v4
- name: Cypress run
id: cypress-run
uses: ./.github/actions/e2e
continue-on-error: true
with:
apiUrl: ${{ needs.testmo-report-preparation.outputs.API_URL}}
appMountUri: ${{ secrets.APP_MOUNT_URI }}
baseUrl: ${{ needs.testmo-report-preparation.outputs.BASE_URL}}
userName: ${{ secrets.CYPRESS_USER_NAME }}
secondUserName: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
userPassword: ${{ secrets.CYPRESS_USER_PASSWORD }}
permissionsUserPassword: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
mailpitUrl: ${{ secrets.CYPRESS_MAILPITURL }}
stripeSecretKey: ${{ secrets.STRIPE_SECRET_KEY }}
stripePublicKey: ${{ secrets.STRIPE_PUBLIC_KEY }}
cypressGrepTags: ${{ env.GREP_TAGS }}
split: ${{ strategy.job-total }}
splitIndex: ${{ strategy.job-index }}
commitInfoMessage: All tests triggered via ${{ github.event_name}} on ${{ steps.get-env-uri.outputs.ENV_URI }}
install: false
browser: ${{ env.BROWSER }}
- name: Testmo threads submit
uses: ./.github/actions/testmo/testmo-threads-submit
with:
testmoUrl: ${{ secrets.TESTMO_URL }}
testmoToken: ${{ secrets.TESTMO_TOKEN }}
testmoRunId: ${{ needs.testmo-report-preparation.outputs.TESTMO_RUN_ID }}
post-tests-results:
defaults:
run:
shell: bash
working-directory: .github/workflows
runs-on: ubuntu-22.04
if: always()
needs: [run-tests-in-parallel, testmo-report-preparation]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: npm ci
- uses: ./.github/actions/combineReportsFromE2E
- name: complete testmo report
uses: ./.github/actions/testmo/testmo-finish
with:
testmoUrl: ${{ secrets.TESTMO_URL }}
testmoToken: ${{ secrets.TESTMO_TOKEN }}
testmoRunId: ${{ needs.testmo-report-preparation.outputs.TESTMO_RUN_ID }}
- name: send message on slack
working-directory: ".github"
env:
run_id: ${{ needs.testmo-report-preparation.outputs.TESTMO_RUN_ID }}
url_to_action: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
testmo_token: ${{ secrets.TESTMO_TOKEN }}
environment: ${{ needs.testmo-report-preparation.outputs.BASE_URL }}
slack_webhook_url: ${{ secrets.SLACK_QA_STATUSES_WEBHOOK_URL }}
ref_name: ${{github.ref_name}}
run: |
node workflows/postTestsResults.js \
--run_id "$run_id" \
--testmo_token "$testmo_token" \
--slack_webhook_url "$slack_webhook_url" \
--environment "$environment" \
--url_to_action "$url_to_action" \
--ref_name "$ref_name"