[REFACTOR] tests segregated for browserstack #14
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
name: CI | |
on: | |
- push | |
- pull_request | |
# Allow running manually | |
- workflow_dispatch | |
jobs: | |
# Tests the list of offline files in the Service Worker and compares it to the contents of the www directory | |
# Also runs end-to-end tests on Windows (taking advantage of the build) | |
# tests-files-windows: | |
# # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch | |
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
# runs-on: windows-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Install dependencies | |
# run: npm ci | |
# - name: Test the list of offline files in Service Worker | |
# run: ./scripts/Check-OfflineFilesList.ps1 | |
# This job runs always, including for remote pull requests, and | |
# has external dependencies or special permission needs, besides a | |
# local install of Node.js, Firefox, and Chromium or Chrome. | |
# | |
# You can run these same tests locally in your own developer | |
# environment via `npm ci && npm test`. | |
tests-linux: | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push to the branch | |
if: github.event_name == 'push' | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 30 | |
steps: | |
# Clone the repo and checkout the commit for which the workflow was triggered | |
- uses: actions/checkout@v3 | |
- name: Test integrity of app parameters | |
run: | | |
# Check that values of assetsCache and appVersion are correctly duplicated | |
chmod +x ./scripts/test_duplicate_values.sh | |
./scripts/test_duplicate_values.sh | |
# Check that PWAServer is correctly set in app.js | |
chmod +x ./scripts/test_pwa_server.sh | |
./scripts/test_pwa_server.sh | |
- name: Install dependencies | |
run: npm ci | |
# - name: Unit tests (Linux) | |
# run: npm run test-unit-browsers | |
- name: Test a full build of the app | |
run: npm run build | |
# - name: End-to-end tests on Chrome (Linux) | |
# env: | |
# GITHUB_ACTION: ${{ github.event_name }} | |
# run: npm run test-e2e-chrome | |
# - name: End-to-end tests on Edge (Linux) | |
# env: | |
# GITHUB_ACTION: ${{ github.event_name }} | |
# run: npm run test-e2e-edge | |
# - name: End-to-end tests on Firefox (Linux) | |
# env: | |
# GITHUB_ACTION: ${{ github.event_name }} | |
# run: npm run test-e2e-firefox | |
- name: BrowserStack environment setup | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
uses: browserstack/github-actions/setup-env@master | |
with: | |
username: ${{ secrets.BROWSERSTACK_USERNAME }} | |
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
- name: BrowserStack local tunnel setup | |
if: github.event_name == 'push' | |
uses: browserstack/github-actions/setup-local@master | |
with: | |
local-testing: start | |
local-identifier: random | |
- name: Run App locally in background | |
if: github.event_name == 'push' | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: npx http-server --silent -p 8099 & | |
- name: Run BrowserStack tests on Edge Legacy 18 / Win10 | |
if: github.event_name == 'push' | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: npx mocha tests/e2e/runners/edge/edge18.bs.runner.js | |
- name: Run BrowserStack tests on Firefox Legacy 56 / Win10 | |
if: github.event_name == 'push' | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: npx mocha tests/e2e/runners/firefox/firefox56.bs.runner.js | |
- name: Run BrowserStack tests on Firefox 61 / Win10 | |
if: github.event_name == 'push' | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: npx mocha tests/e2e/runners/firefox/firefox61.bs.runner.js | |
- name: Run BrowserStack tests on Chrome 58 / Mojave | |
if: github.event_name == 'push' | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: npx mocha tests/e2e/runners/chrome/chrome58.bs.runner.js | |
- name: Run BrowserStack tests on Safari 14 / Big Sur | |
if: github.event_name == 'push' | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: npx mocha tests/e2e/runners/safari/safari14.bs.runner.js | |
- name: Stop BrowserStackLocal | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
uses: browserstack/github-actions/setup-local@master | |
with: | |
local-testing: stop | |
# tests-windows: | |
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
# runs-on: windows-latest | |
# timeout-minutes: 30 | |
# steps: | |
# # Clone the repo and checkout the commit for which the workflow was triggered | |
# - uses: actions/checkout@v3 | |
# - name: Install dependencies | |
# run: npm ci | |
# - name: Build App | |
# run: npm run build-min | |
# - name: Unit tests (Windows) | |
# run: | | |
# $AggregateExitCode = 0 | |
# npm run test-unit-edge | |
# $AggregateExitCode += $LastExitCode | |
# npm run test-unit-firefox | |
# $AggregateExitCode += $LastExitCode | |
# if ($AggregateExitCode -ne 0) { | |
# echo " " | |
# Write-Error "Number of failed tests: $AggregateExitCode" | |
# } | |
# exit $AggregateExitCode | |
# - name: End-to-end tests on Chrome(Windows) | |
# env: | |
# GITHUB_ACTION: ${{ github.event_name }} | |
# run: npm run test-e2e-chrome | |
# - name: End-to-end tests on Edge(Windows) | |
# env: | |
# GITHUB_ACTION: ${{ github.event_name }} | |
# run: npm run test-e2e-edge | |
# - name: End-to-end tests on Firefox(Windows) | |
# env: | |
# GITHUB_ACTION: ${{ github.event_name }} | |
# run: npm run test-e2e-firefox | |
# tests-unit-mac: | |
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
# runs-on: macos-latest | |
# steps: | |
# # Clone the repo and checkout the commit for which the workflow was triggered | |
# - uses: actions/checkout@v3 | |
# - name: Install dependencies | |
# run: npm ci | |
# - name: Unit tests (Mackintosh) | |
# run: | | |
# npx testcafe remote ./tests/initTestCafe.js --hostname localhost --ports 1337,1338 & | |
# pid=$! | |
# open -a Safari http://localhost:1337 | |
# wait $pid | |