Skip to content

Commit

Permalink
Multi browser
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbousquet committed May 12, 2022
1 parent 3d3636f commit 50b771b
Showing 1 changed file with 117 additions and 6 deletions.
123 changes: 117 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,131 @@ name: Cypress Tests
on: [push]

jobs:
cypress-run:
setup-node_modules:
runs-on: ubuntu-latest
container: cypress/browsers:node14.17.0-chrome88-ff89
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cypress install
uses: cypress-io/github-action@v2
with:
runTests: false
# report machine parameters
- name: Use Node 16
uses: actions/setup-node@v1
with:
node-version: 16

- name: Cache Cypress 📦
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: my-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}
# loading an older version is fine here, since it will get an npm install
restore-keys: |
node_modules-
- name: Install dependencies
run: npm ci



ui-chrome-tests:
timeout-minutes: 15
runs-on: ubuntu-latest
container: cypress/browsers:node14.17.0-chrome88-ff89
needs: setup-node_modules
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: [1, 2, 3, 4, 5]
steps:
- name: Checkout
uses: actions/checkout@v2
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: actions/checkout@v3

- name: Load node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}
# no restore-keys here, so we only accept this exact version

- name: Load cypress binary
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: my-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: "UI Tests - Chrome"
uses: cypress-io/github-action@v2
with:
install: false
start: npm start
wait-on: http://localhost:4200
browser: chrome
record: true
parallel: true
group: "UI - Chrome"
env:
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

ui-firefox-tests:
timeout-minutes: 15
runs-on: ubuntu-latest
container:
image: cypress/browsers:node14.17.0-chrome88-ff89
options: --user 1001
needs: setup-node_modules
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: [1, 2, 3, 4, 5]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Load node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}
# no restore-keys here, so we only accept this exact version

- name: Load cypress binary
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: my-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: "UI Tests - Firefox"
uses: cypress-io/github-action@v2
with:
build: npm run build
install: false
start: npm start
wait-on: http://localhost:4200
browser: firefox
record: true
parallel: true
group: "UI - Firefox"
env:
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

0 comments on commit 50b771b

Please sign in to comment.