Skip to content

Cypress Tests

Cypress Tests #415

Workflow file for this run

name: Cypress Tests
on: [deployment_status]
jobs:
e2e:
if: ${{ false }}
#if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- name: Print URL 🖨
run: echo Testing URL ${{ github.event.deployment_status.target_url }}
- name: Checkout 🛎
uses: actions/checkout@v2
- name: Run Cypress 🌲
uses: cypress-io/github-action@v4
with:
config: baseUrl=${{ github.event.deployment_status.target_url }}
cache-key: node-v16-on-${{ runner.os }}-hash-${{ hashFiles('yarn.lock') }}
env:
CYPRESS_WORDPRESS_PREVIEW_SECRET: ${{ secrets.WORDPRESS_PREVIEW_SECRET }}
- name: Cypress tests ✅
if: ${{ success() }}
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"context": "e2e",
"state": "success",
"description": "Cypress tests passed",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}'
- name: Cypress tests 🚨
if: ${{ failure() }}
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"context": "e2e",
"state": "failure",
"description": "Cypress tests failed",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}'