Integration Tests #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration Tests | |
on: | |
schedule: | |
- cron: '00 09 * * *' | |
workflow_call: | |
inputs: | |
environment: | |
required: true | |
type: string | |
description: Select the Environment | |
canary: | |
description: 'run the tests on canary version' | |
required: false | |
type: boolean | |
default: false | |
notify: | |
description: 'notify result with slack message' | |
required: false | |
type: boolean | |
default: false | |
workflow_dispatch: | |
inputs: | |
environment: | |
required: true | |
type: choice | |
description: Select the Environment | |
options: | |
- local | |
- dev | |
- uat | |
canary: | |
description: 'run the tests on canary version' | |
required: false | |
type: boolean | |
default: false | |
notify: | |
description: 'notify result with slack message' | |
required: false | |
type: boolean | |
default: false | |
permissions: | |
id-token: write | |
contents: read | |
deployments: write | |
jobs: | |
integration_test: | |
name: Test ${{(github.event.inputs == null && 'dev') || inputs.environment }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 | |
- name: Set Node.js 18 | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 | |
with: | |
node-version: 18.15.0 | |
- name: Run Integration Tests Puppeteer | |
shell: bash | |
run: | | |
cd ./integration-test | |
yarn install | |
if [ "${{ inputs.environment }}" = "local" ]; then | |
export KEY_PEM='${{ secrets.DEV_KEY_PEM }}' | |
export FE_URL=https://icy-island-050778e03-${{ github.event.number }}.westeurope.5.azurestaticapps.net/ui | |
fi | |
if [ "${{ inputs.environment }}" = "dev" ]; then | |
export KEY_PEM='${{ secrets.DEV_KEY_PEM }}' | |
export FE_URL="https://selfcare.dev.platform.pagopa.it/ui" | |
fi | |
if [ "${{ inputs.environment }}" = "uat" ]; then | |
export KEY_PEM='${{ secrets.UAT_KEY_PEM }}' | |
export FE_URL="https://selfcare.uat.platform.pagopa.it/ui" | |
fi | |
yarn run cucumber | |
- name: Run Integration Tests Playwright | |
shell: bash | |
run: | | |
cd ./e2e | |
yarn install | |
npx playwright install --with-deps | |
if [ "${{ inputs.environment }}" = "local" ]; then | |
export KEY_PEM='${{ secrets.DEV_KEY_PEM }}' | |
export FE_URL=https://icy-island-050778e03-${{ github.event.number }}.westeurope.5.azurestaticapps.net/ui | |
fi | |
if [ "${{ inputs.environment }}" = "dev" ]; then | |
export KEY_PEM='${{ secrets.DEV_KEY_PEM }}' | |
export FE_URL="https://selfcare.dev.platform.pagopa.it/ui" | |
fi | |
if [ "${{ inputs.environment }}" = "uat" ]; then | |
export KEY_PEM='${{ secrets.UAT_KEY_PEM }}' | |
export FE_URL="https://selfcare.uat.platform.pagopa.it/ui" | |
fi | |
FE_URL=$FE_URL npx playwright test --workers=1 --project=chromium | |
print_debug: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump Inputs | |
env: | |
JSON_INPUTS: ${{ toJson(inputs) }} | |
run: echo "$JSON_INPUTS" | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Dump job context | |
env: | |
JOB_CONTEXT: ${{ toJson(job) }} | |
run: echo "$JOB_CONTEXT" | |
- name: Dump steps context | |
env: | |
STEPS_CONTEXT: ${{ toJson(steps) }} | |
run: echo "$STEPS_CONTEXT" | |
- name: Dump runner context | |
env: | |
RUNNER_CONTEXT: ${{ toJson(runner) }} | |
run: echo "$RUNNER_CONTEXT" | |
- name: Dump strategy context | |
env: | |
STRATEGY_CONTEXT: ${{ toJson(strategy) }} | |
run: echo "$STRATEGY_CONTEXT" | |
- name: Dump matrix context | |
env: | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} | |
run: echo "$MATRIX_CONTEXT" | |
notify: | |
needs: [ integration_test ] | |
runs-on: ubuntu-latest | |
name: Notify | |
if: ${{ always() && inputs.notify == true && github.event_name != 'schedule' }} | |
steps: | |
- name: Report Status | |
uses: ravsamhq/notify-slack-action@be814b201e233b2dc673608aa46e5447c8ab13f2 # v2 | |
with: | |
status: ${{ needs.integration_test.result }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
notify_when: 'success,failure,skipped' | |
notification_title: '<{run_url}| Integration Test> has {status_message} in ${{ inputs.environment }}' | |
message_format: '{emoji} <{run_url}|{workflow}> {status_message} in <{repo_url}|{repo}>' | |
footer: 'Linked to <{workflow_url}| workflow file>' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |