Skip to content

Improve performance of Cypress tests & save screenshots of failed tests #93

Improve performance of Cypress tests & save screenshots of failed tests

Improve performance of Cypress tests & save screenshots of failed tests #93

Workflow file for this run

name: End to end tests
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development
jobs:
tests:
runs-on: self-hosted
strategy:
# don't fail the entire matrix on failure
fail-fast: false
matrix:
test-platform: [firefox]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/prepare-action
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
app-debug: false
wp-username: ${{ secrets.WP_USERNAME }}
wp-password: ${{ secrets.WP_PASSWORD }}
node-version: 16.x
- name: Cypress run
uses: cypress-io/github-action@v6
with:
start: npm run web
browser: ${{ matrix.test-platform }}
- name: Upload screenshots of failed tests
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
retention-days: 1
# Put your steps here to generate the files to upload.
# Usually configure Node.js, build, etc.
# Finally, upload the artifacts and post comment:
- name: Add artifacts to current pull request
uses: gavv/pull-request-artifacts@v2
with:
# Commit hash that triggered PR
commit: ${{ github.event.pull_request.head.sha }}
# Token for current repo (used to post PR comment)
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Optional, uncomment to upload to another repository
#artifacts-token: ${{ secrets.ANOTHER_TOKEN_WITH_PUSH_ACCESS }}
#artifacts-repo: some/repository_name
# Optional, uncomment to upload artifacts to specific branch, otherwise
# the default branch is used.
# Note that usually the main branch is protected by rules, so it's not
# possible to upload there.
# Perhaps, the best solution is to create an empty unprotected branch
# dedicated for artifacts.
# See README for details.
#artifacts-branch: some_branch
# Optional, uncomment to preserve artifacts path and add prefix.
# By default artifacts are uploaded to "pr<pr_number>-<artifact_basename>".
# With options below, artifacts will be uploaded to "my_prs/<pr_number>/<artifact_path>".
#artifacts-prefix: "my_prs/${{ github.event.number }}/"
#preserve-path: true
# Optional, uncomment to use non-default title and style.
comment-title: "Cypress screenshot artifacts"
comment-style: list
# Whitespace-separated list of files to upload
artifacts: |
cypress/screenshots
- uses: ./.github/cleanup-action
if: always()