Skip to content

Merge branch 'master' into dev #253

Merge branch 'master' into dev

Merge branch 'master' into dev #253

Workflow file for this run

# This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course.
# © Copyright Utrecht University (Department of Information and Computing Sciences)
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
name: UI Tests
on:
workflow_dispatch:
push:
branches: ['master', 'dev']
pull_request:
branches: ['master', 'dev']
env:
NODE_VERSION: 18.x
jobs:
# Install and cache npm dependencies
install-cache:
runs-on: ubuntu-latest
steps:
- name: Checkout Commit
uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v3
id: npm-cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build
- name: Install dependencies if cache invalid
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
# Run Jest unit tests
jest-unit-tests:
runs-on: ubuntu-latest
needs: install-cache
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Restore npm cache
uses: actions/cache@v3
id: npm-cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build
- name: run tests
run: npm run test
# Run interaction and accessibility tests with Axe
interaction-and-accessibility-tests:
runs-on: ubuntu-latest
needs: install-cache
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Restore npm cache
uses: actions/cache@v3
id: npm-cache
with:
path: |
**/node_modules
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build
- name: Install Playwright
run: npx playwright install --with-deps
- name: Build Storybook
run: npm run build-storybook --quiet
- name: Serve Storybook and run tests
# Sleep for 60 seconds after the storybook instance is running to give it time to set up properly
run: |
npm i concurrently wait-on
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" "npm run storybook" "npx wait-on tcp:6006 && sleep 60 && npm run test-storybook --maxWorkers=10"