Run All Tests Headless #59
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
# https://github.com/marketplace/actions/cypress-io | |
name: Run All Tests Headless | |
on: | |
workflow_dispatch: | |
inputs: | |
ru: | |
description: The variable to be passed | |
required: false | |
default: TEST | |
schedule: | |
- cron: 0 7 * * 1 | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
containers: [1, 2] # Uses 2 parallel instances | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.14.2 | |
- name: Update & Install Ubuntu packages | |
run: | | |
env | |
sudo apt-get update && sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb | |
- name: Update & Install NPM packages | |
run: | | |
npx browserslist@latest --update-db | |
npm ci | |
- name: Clear Report | |
run: | | |
echo "Clear the report" | |
npm run delete-mochawesome-report | |
npm run delete-results | |
- name: Run Tests | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: chrome | |
spec: 'cypress/e2e/**/*' # Run all tests. Same as empty string '' | |
env: | |
CYPRESS_RU: ${{ github.event.inputs.ru }} | |
SPLIT: ${{ strategy.job-total }} | |
SPLIT_INDEX: ${{ strategy.job-index }} | |
# CYPRESS_BASE_URL: '' # Fil in new baseUrl with https prefix | |
- name: Prepare report | |
if: success() || failure() | |
run: | | |
mkdir -p cypress/results/ | |
cp -r cypress/reports/html/* cypress/results/ | |
- name: Archive results | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: | | |
cypress/results/** | |