From 1dad32652946f7cc9b89fb94b81f0df783fc2d91 Mon Sep 17 00:00:00 2001 From: Oscar Reyes Date: Fri, 5 Apr 2024 15:23:15 -0600 Subject: [PATCH] chore: adding cypress for stage --- .github/workflows/cypress-stage.yml | 59 +++++++++++++++++++++++++++++ .github/workflows/cypress.yml | 1 + 2 files changed, 60 insertions(+) create mode 100644 .github/workflows/cypress-stage.yml diff --git a/.github/workflows/cypress-stage.yml b/.github/workflows/cypress-stage.yml new file mode 100644 index 0000000..8b6f12a --- /dev/null +++ b/.github/workflows/cypress-stage.yml @@ -0,0 +1,59 @@ +name: Cypress Tests + +on: + # allows the manual trigger + workflow_dispatch: + + schedule: + - cron: '0 */1 * * *' # every hour + +jobs: + cypress-run: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + # Install NPM dependencies, cache them correctly + # and run all Cypress tests + - name: Cypress run + uses: cypress-io/github-action@v6 + env: + TRACETEST_API_TOKEN: ${{secrets.TRACETEST_TOKEN_STAGE}} + POKESHOP_DEMO_URL: ${{secrets.POKESHOP_DEMO_URL_STAGE}} + + - name: Send message on Slack in case of failure + if: ${{ failure() }} + uses: slackapi/slack-github-action@v1.24.0 + with: + # check the block kit builder docs to understand how it works + # and how to modify it: https://api.slack.com/block-kit + payload: | + { + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": ":warning: Synthetic Monitoring Alert - E2E Cypress - Pokeshop Demo :warning:", + "emoji": true + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Status:*\nFailed" + }, + { + "type": "mrkdwn", + "text": "*Pipeline:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow>" + } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SYNTETIC_MONITORING_SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 4d2d27a..3bbab91 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -21,6 +21,7 @@ jobs: env: TRACETEST_API_TOKEN: ${{secrets.TRACETEST_TOKEN}} POKESHOP_DEMO_URL: ${{secrets.POKESHOP_DEMO_URL}} + - name: Send message on Slack in case of failure if: ${{ failure() }} uses: slackapi/slack-github-action@v1.24.0