Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated regression tests to be a part of the CICD pipelines #1464

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/build-production-deploy-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ on:
branches:
- main
jobs:
trigger-cypress-tests:
uses: ./.github/workflows/run-cypress-tests.yml
with:
environment: 'production'
grep: ''
grepTags: '@essential'
CYPRESS_ADMIN_EN_EMAIL: ${{ vars.CYPRESS_ADMIN_EN_EMAIL }}
CYPRESS_ADMIN_FR_EMAIL: ${{ vars.CYPRESS_ADMIN_FR_EMAIL }}
CYPRESS_GUEST_EN_EMAIL: ${{ vars.CYPRESS_GUEST_EN_EMAIL }}
CYPRESS_GUEST_FR_EMAIL: ${{ vars.CYPRESS_GUEST_FR_EMAIL }}
secrets:
DOCKER_PAT: ${{ secrets.DOCKER_PAT }}
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}

build-and-deploy:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/build-staging-deploy-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@ on:
branches:
- develop
jobs:
trigger-cypress-tests:
uses: ./.github/workflows/run-cypress-tests.yml
with:
environment: 'staging'
grep: ''
grepTags: '@general'
CYPRESS_ADMIN_EN_EMAIL: ${{ vars.CYPRESS_ADMIN_EN_EMAIL }}
CYPRESS_ADMIN_FR_EMAIL: ${{ vars.CYPRESS_ADMIN_FR_EMAIL }}
CYPRESS_GUEST_EN_EMAIL: ${{ vars.CYPRESS_GUEST_EN_EMAIL }}
CYPRESS_GUEST_FR_EMAIL: ${{ vars.CYPRESS_GUEST_FR_EMAIL }}
secrets:
DOCKER_PAT: ${{ secrets.DOCKER_PAT }}
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}

build-and-deploy:
needs: trigger-cypress-tests
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/run-cypress-tests-develop.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/run-cypress-tests-main.yml

This file was deleted.

65 changes: 36 additions & 29 deletions .github/workflows/run-cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ on:
description: 'Grep tags for selecting tests'
required: false
default: '@essential'
CYPRESS_ADMIN_EN_EMAIL:
description: 'Admin email for English tests'
required: true
type: string
CYPRESS_ADMIN_FR_EMAIL:
description: 'Admin email for French tests'
required: true
type: string
CYPRESS_GUEST_EN_EMAIL:
description: 'Guest email for English tests'
required: true
type: string
CYPRESS_GUEST_FR_EMAIL:
description: 'Guest email for French tests'
required: true
type: string

workflow_call:
inputs:
Expand All @@ -31,6 +47,22 @@ on:
required: false
type: string
default: '@essential'
CYPRESS_ADMIN_EN_EMAIL:
description: 'Admin email for English tests'
required: true
type: string
CYPRESS_ADMIN_FR_EMAIL:
description: 'Admin email for French tests'
required: true
type: string
CYPRESS_GUEST_EN_EMAIL:
description: 'Guest email for English tests'
required: true
type: string
CYPRESS_GUEST_FR_EMAIL:
description: 'Guest email for French tests'
required: true
type: string

secrets:
DOCKER_PAT:
Expand Down Expand Up @@ -150,42 +182,17 @@ jobs:
run: |

base_url="http://test.footlight.app:3000/"

# grep_value="${{ inputs.grep }}"
# echo "Original grep_value: '$grep_value'"
# grep_value_clean=$(echo "$grep_value" | tr -d '\n\r')
# echo "Cleaned grep_value: '$grep_value_clean'"

# if [ -z "$grep_value_clean" ]; then
# grep_value_json='""'
# else
# grep_value_json=$(printf '%s' "$grep_value_clean" | sed 's/"/\\"/g; s/.*/"&"/')
# fi

# echo "JSON grep_value: '$grep_value_json'"

# # Properly format the --env argument for Cypress
# env_json="{\"grepTags\":\"${{ inputs.grepTags }}\",\"grep\":${grep_value_json}}"
# echo "Formatted env JSON: $env_json"

# # Simulate the Cypress --env argument
# env_arg=$(printf '%s' "$env_json")
# echo "Simulated --env argument for Cypress: $env_arg"

# # Validate JSON formatting
# echo "$env_json" | jq . # Validate JSON formatting


# Run Cypress tests with the formatted --env argument
docker run \
--network footlight-network.test \
-e DEBUG="" \
-e XDG_RUNTIME_DIR=/tmp/runtime \
-e CYPRESS_BASE_URL=$base_url \
-e CYPRESS_ADMIN_EN_EMAIL="${{ vars.CYPRESS_ADMIN_EN_EMAIL }}" \
-e CYPRESS_ADMIN_FR_EMAIL="${{ vars.CYPRESS_ADMIN_FR_EMAIL }}" \
-e CYPRESS_GUEST_EN_EMAIL="${{ vars.CYPRESS_GUEST_EN_EMAIL }}" \
-e CYPRESS_GUEST_FR_EMAIL="${{ vars.CYPRESS_GUEST_FR_EMAIL }}" \
-e CYPRESS_ADMIN_EN_EMAIL="${{ inputs.CYPRESS_ADMIN_EN_EMAIL }}" \
-e CYPRESS_ADMIN_FR_EMAIL="${{ inputs.CYPRESS_ADMIN_FR_EMAIL }}" \
-e CYPRESS_GUEST_EN_EMAIL="${{ inputs.CYPRESS_GUEST_EN_EMAIL }}" \
-e CYPRESS_GUEST_FR_EMAIL="${{ inputs.CYPRESS_GUEST_FR_EMAIL }}" \
-e CYPRESS_ADMIN_EN_PASSWORD=${{ secrets.CYPRESS_PASSWORD }} \
-e CYPRESS_ADMIN_FR_PASSWORD=${{ secrets.CYPRESS_PASSWORD }} \
-e CYPRESS_GUEST_EN_PASSWORD=${{ secrets.CYPRESS_PASSWORD }} \
Expand Down