Skip to content

Commit

Permalink
added cypress env file for server name and future OTP code worker
Browse files Browse the repository at this point in the history
  • Loading branch information
norbertschuler committed Oct 16, 2021
1 parent 750a0c8 commit 39ffbe3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
env:
AUTH0_CLIENT_ID : ${{ secrets.AUTH0_CLIENT_ID }}
AUTH0_CUSTOM_DOMAIN: ${{ secrets.AUTH0_CUSTOM_DOMAIN }}
TEST_MFA_URL: ${{ secrets.TEST_MFA_URL }}
ESRI_CLIENT_ID: ${{ secrets.ESRI_CLIENT_ID }}
ESRI_CLIENT_SECRET: ${{ secrets.ESRI_CLIENT_SECRET }}
run: |
Expand All @@ -32,10 +33,15 @@ jobs:
echo "ESRI_CLIENT_SECRET=$ESRI_CLIENT_SECRET" >> .env
echo "SCHEME=https" >> .env
echo "{
\"TEST_SERVER\": \"http://localhost:3000\",
\"TEST_MFA_URL\": \"$TEST_MFA_URL\"
}" >> cypress.env.json
- name: 'Running Cypress tests'
run: |
cat .env > .env.production
npm run build && (npm run start & npm run cypress:run --config baseUrl=http://localhost:3000)
npm run build && (npm run start & npm run cypress:run)
- name: 'Upload Artifact'
if: ${{ failure() }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ yarn-error.log*
.env.test.local
.env.production.local

# Cypress env
cypress.env.json

# vercel
.vercel

Expand Down
12 changes: 6 additions & 6 deletions cypress/integration/languageTest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe("Language Test", () => {
it("Deutsch", () => {
cy.visit(`localhost:3000/?to=yucatan`)
cy.visit(Cypress.env('TEST_SERVER') + `/?to=yucatan`)
cy.get('[data-test-id="languageButton"]').click()
cy.wait(2000).then(() => {
cy.contains("Deutsch").click()
Expand All @@ -17,12 +17,12 @@ describe("Language Test", () => {
cy.wait(15000).then(() => {
cy.get('[data-test-id="test-thankYou"]').should("have.text", "Vielen Dank")
})
})
})
})
})

it("Español", () => {
cy.visit(`localhost:3000/?to=yucatan`)
cy.visit(Cypress.env('TEST_SERVER') + `/?to=yucatan`)
cy.get('[data-test-id="languageButton"]').click()
cy.wait(2000).then(() => {
cy.contains("Español").click()
Expand All @@ -42,7 +42,7 @@ describe("Language Test", () => {
})

it("Français", () => {
cy.visit(`localhost:3000/?to=yucatan`)
cy.visit(Cypress.env('TEST_SERVER') + `/?to=yucatan`)
cy.get('[data-test-id="languageButton"]').click()
cy.wait(2000).then(() => {
cy.contains("Français").click()
Expand All @@ -62,7 +62,7 @@ describe("Language Test", () => {
})

it("Italiano", () => {
cy.visit(`localhost:3000/?to=yucatan`)
cy.visit(Cypress.env('TEST_SERVER') + `/?to=yucatan`)
cy.get('[data-test-id="languageButton"]').click()
cy.wait(2000).then(() => {
cy.contains("Italiano").click()
Expand All @@ -82,7 +82,7 @@ describe("Language Test", () => {
})

it("Português brasileiro", () => {
cy.visit(`localhost:3000/?to=yucatan`)
cy.visit(Cypress.env('TEST_SERVER') + `/?to=yucatan`)
cy.get('[data-test-id="languageButton"]').click()
cy.wait(2000).then(() => {
cy.contains("Português brasileiro").click()
Expand Down
16 changes: 8 additions & 8 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Cypress.Commands.add('SearchProject', (project) => {
})

Cypress.Commands.add('createDonation', (customTrees, country) => {
cy.visit(`localhost:3000`)
cy.visit(Cypress.env('TEST_SERVER') + "/")
cy.wait(5000)
cy.SearchProject('yucatan')
cy.get('#yucatan').click()
Expand Down Expand Up @@ -156,7 +156,7 @@ Cypress.Commands.add('contactForm', (firstName, lastName, email, address, city,
})
})
Cypress.Commands.add('multipleDonation',(country) => {
cy.visit(`localhost:3000`)
cy.visit(Cypress.env('TEST_SERVER') + "/")
cy.wait(5000)
cy.SearchProject('yucatan')
cy.get('#yucatan').click()
Expand All @@ -173,7 +173,7 @@ Cypress.Commands.add('multipleDonation',(country) => {
})

Cypress.Commands.add('giftDonation', ( customTrees, country) => {
cy.visit(`localhost:3000`)
cy.visit(Cypress.env('TEST_SERVER') + "/")
cy.wait(5000)
cy.SearchProject('yucatan')
cy.get('#yucatan').click()
Expand Down Expand Up @@ -230,7 +230,7 @@ Cypress.Commands.add('paymentError', (cardNumber, cardExpiry, cardCvc) => {
})
Cypress.Commands.add('supportGift', (project = "yucatan", customTrees, firstName, lastName, email, address, city, country, zipCode) => {
cy.visit({
url: `/?to=${project}`,
url: Cypress.env('TEST_SERVER') + `/?to=${project}`,
qs: { 's': 'sagar-aryal' }
})
cy.wait(5000)
Expand All @@ -244,7 +244,7 @@ Cypress.Commands.add('supportGift', (project = "yucatan", customTrees, firstName
})

Cypress.Commands.add('yearlyDonation', (customTrees, country) => {
cy.visit(`localhost:3000`)
cy.visit(Cypress.env('TEST_SERVER') + "/")
cy.wait(5000)
cy.SearchProject('yucatan')
cy.get('#yucatan').click()
Expand All @@ -262,7 +262,7 @@ Cypress.Commands.add('yearlyDonation', (customTrees, country) => {
})

Cypress.Commands.add('monthlyDonation', (customTrees, country) => {
cy.visit(`localhost:3000`)
cy.visit(Cypress.env('TEST_SERVER') + "/")
cy.wait(5000)
cy.SearchProject('yucatan')
cy.get('#yucatan').click()
Expand All @@ -279,7 +279,7 @@ Cypress.Commands.add('monthlyDonation', (customTrees, country) => {

Cypress.Commands.add('bouquetDonation', (projectID="proj_6x3GTD5cMRv0OeQAiIlJZ0Au", country, code="us", tenant="ten_I9TW3ncG") => {
cy.visit({
url: `/?to=${projectID}&country=${code}&tenant=${tenant}`
url: Cypress.env('TEST_SERVER') + `/?to=${projectID}&country=${code}&tenant=${tenant}`
})
cy.wait(5000)
cy.get('.funding-selection-option-text').eq(1).click()
Expand All @@ -292,7 +292,7 @@ Cypress.Commands.add('bouquetDonation', (projectID="proj_6x3GTD5cMRv0OeQAiIlJZ0A
})

Cypress.Commands.add('referenceDonation', (customTrees, country) => {
cy.visit(`localhost:3000`)
cy.visit(Cypress.env('TEST_SERVER') + "/")
cy.wait(5000)
cy.SearchProject('yucatan')
cy.get('#yucatan').click()
Expand Down

0 comments on commit 39ffbe3

Please sign in to comment.