Integration Tests #104
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: true | |
workflow_dispatch: | |
inputs: | |
environment: | |
required: true | |
type: choice | |
description: Select the Environment | |
options: | |
- local | |
- dev | |
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 | |
pages: write | |
concurrency: | |
group: "integration" | |
cancel-in-progress: true | |
jobs: | |
integration_test: | |
name: Test ${{(inputs.environment == 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: | | |
export KEY_PEM='${{ secrets.DEV_KEY_PEM }}' | |
if [ "${{ inputs.environment || 'dev' }}" = "local" ]; then | |
export FE_URL=https://icy-island-050778e03-${{ github.event.number }}.westeurope.5.azurestaticapps.net/ui | |
fi | |
if [ "${{ inputs.environment || 'dev' }}" = "dev" ]; then | |
export FE_URL="https://selfcare.dev.platform.pagopa.it/ui" | |
fi | |
cd ./integration-test | |
yarn install | |
yarn run cucumber | |
- name: Run Integration Tests Playwright | |
shell: bash | |
run: | | |
cd ./e2e | |
yarn install | |
npx playwright install --with-deps | |
export KEY_PEM='${{ secrets.DEV_KEY_PEM }}' | |
export SUBKEY='${{ secrets.DEV_SUBKEY }}' | |
npx playwright test --workers=1 --max-failures=1 --project=chromium | |
- name: Setup Pages | |
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 | |
with: | |
path: './e2e/playwright-report/' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 | |
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() && (github.event_name == 'schedule' || inputs.notify == true ) }} | |
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 || 'dev'}}" | |
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 }} | |