Skip to content

Commit 6c68dec

Browse files
authored
Update Cypress CI (#633)
1 parent 60b1b6d commit 6c68dec

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

.github/workflows/cypress.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches:
55
- master
66
- dev
7+
- dev2
78

89
jobs:
910
chrome:
@@ -12,16 +13,32 @@ jobs:
1213
steps:
1314
- name: Checkout 🔖
1415
uses: actions/[email protected]
16+
1517
- name: Setup Node.js 🔨
1618
uses: actions/[email protected]
1719
with:
1820
node-version: 20
1921

22+
- name: Set Test Domain Environment Variable
23+
run: |
24+
if [ "${{ github.ref_name }}" == "master" ]; then
25+
echo "TEST_DOMAIN=ssl-secure-srv.org" >> $GITHUB_ENV
26+
elif [ "${{ github.ref_name }}" == "dev" ]; then
27+
echo "TEST_DOMAIN=honeypdfs.com" >> $GITHUB_ENV
28+
elif [ "${{ github.ref_name }}" == "dev2" ]; then
29+
echo "TEST_DOMAIN=syruppdfs.com" >> $GITHUB_ENV
30+
else
31+
echo "No matching branch for domain testing. Exiting." && exit 1
32+
fi
33+
34+
- name: Debug Test Domain
35+
run: echo "TEST_DOMAIN=${{ env.TEST_DOMAIN }}"
36+
2037
- name: Execute Cypress Tests 🌡️
2138
uses: cypress-io/[email protected]
2239
with:
2340
working-directory: ./cypress-tests
24-
command: npx cypress run --headless --browser chrome
41+
command: npx cypress run --headless --browser chrome --env TEST_DOMAIN=${{ env.TEST_DOMAIN }}
2542

2643
- name: Upload screenshots of tests failed 📷
2744
uses: actions/[email protected]

cypress-tests/cypress/e2e/canary-tokens.cy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ describe('Token Tests', () => {
3838

3939
items.forEach(item => {
4040
it(`should execute the test for ${item.name}`, () => {
41-
cy.visit('https://honeypdfs.com/')
42-
41+
const domain = Cypress.env('TEST_DOMAIN')
42+
cy.visit(`https://${domain}/`)
43+
4344
cy.contains(item.name).click()
4445

4546
cy.get('#email').type('[email protected]')

0 commit comments

Comments
 (0)