-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (145 loc) · 5.25 KB
/
smart_ui_test.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Smart UI Test
on:
# Manual triggers with workflow_dispatch
workflow_dispatch:
push:
branches:
- "main"
# Add this part if you want to schedule test rerun
# schedule:
# Runs once every 4 hours
# - cron: '0 18 * * *'
# Runs every 2 hours
# - cron: '0 */2 * * *'
# Runs from 9AM to 5PM PST every 2 hours and one last run at 10PM on weekdays.
# Total 6,732 runs approx per month
# - cron: '0 1,6,17,19,21,23 * * 1-5'
# Runs at 10AM & 10PM PST on weekends.
# Total 816 runs approx per month
# - cron: '0 6,18 * * 6,0'
jobs:
cypress-tests:
name: E2E Test Run
# timeout-minutes: 15
runs-on: ubuntu-22.04
container:
image: cypress/browsers:latest
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: [1]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install project
run: |
npm ci
- name: Cypress info
run: npx cypress info
- name: Node info
run: node -v
- name: "Smoke Tests - Chrome"
uses: cypress-io/github-action@v6
with:
browser: chrome
# Enable the below flags only after you configure the project with Cypress cloud
command: npm run cypress:lambda
env:
ENV: "production"
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Percy token
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
#LambdaTest SmartUI Token
PROJECT_TOKEN: ${{ secrets.PROJECT_TOKEN }}
# Pre-production authentication
CYPRESS_BASIC_AUTH_USERNAME: ${{ secrets.BASIC_AUTH_USERNAME }}
CYPRESS_BASIC_AUTH_PASSWORD: ${{ secrets.BASIC_AUTH_PASSWORD }}
#Login info
CYPRESS_USERNAME: ${{ secrets.USERNAME }}
CYPRESS_PASSWORD: ${{ secrets.PASSWORD }}
- name: Save results folder
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
cypress/results
cypress.config.js
package.json
reporter-config.json
post-tests-results:
runs-on: ubuntu-latest
# container:
# image: cypress/browsers:node16.13.0-chrome95-ff94
# options: --user 1001
needs: cypress-tests
if: ${{ always() }}
steps:
- name: Download the results folders
uses: actions/download-artifact@v3
with:
name: test-results
- name: Test Artifact download
run: ls -R
# - name: Creating a public directory and setting permissions
# if: ${{ always() }}
# run: |
# mkdir public
# cp -r cypress/videos public/videos
- name: Merge test results into one
if: ${{ always() }}
run: npm run report:merge
- name: Generate HTML report
if: ${{ always() }}
run: npm run report:generate
- name: Deploy report page
if: ${{ always() }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
# - name: "Cypress Email Results"
# uses: cypress-io/github-action@v4
# with:
# runTests: false
# config-file: email.config.js
# env:
# # email test results after the tests are finished
# EMAIL_TO: ${{ secrets.EMAIL_TO }}
# # pass SendGrid settings to the plugin via environment variables
# SENDGRID_HOST: ${{ secrets.SENDGRID_HOST }}
# SENDGRID_PORT: ${{ secrets.SENDGRID_PORT }}
# SENDGRID_USER: ${{ secrets.SENDGRID_USER }}
# SENDGRID_PASSWORD: ${{ secrets.SENDGRID_PASSWORD }}
# SENDGRID_FROM: ${{ secrets.SENDGRID_FROM }}
# - name: Post Slack Notification
# uses: 8398a7/action-slack@v3
# with:
# username: "CYPRESS-E2E-REPORT"
# status: custom
# fields: workflow,message,commit,repo,ref,author
# custom_payload: |
# {
# attachments: [{
# color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
# text: `${process.env.AS_WORKFLOW}\n (${process.env.AS_MESSAGE})-(${process.env.AS_COMMIT}) of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} ${{ job.status }}`,
# }]
# }
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
# if: always() # Pick up events even if the job fails or is cancelled.