Skip to content

Browser tests

Browser tests #267

Workflow file for this run

name: Run Tests
on:
push:
branches:
- main
- staging
- frontend-websocket-test
pull_request:
branches:
- main
- staging
workflow_dispatch:
jobs:
question-service-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up .env
env:
QUESTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
EXECUTION_SERVICE_URL: ${{ vars.EXECUTION_SERVICE_URL }}
run: |
cd ./apps/question-service
echo "FIREBASE_CREDENTIAL_PATH=$QUESTION_FIREBASE_CREDENTIAL_PATH" >> .env
echo "JWT_SECRET=$JWT_SECRET" >> .env
echo "EXECUTION_SERVICE_URL=$EXECUTION_SERVICE_URL" >> .env
- name: Set up credentials
env:
QUESTION_FIREBASE_JSON: ${{ secrets.QUESTION_SERVICE_FIREBASE_CREDENTIAL }}
QUESTION_FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }}
run: |
cd ./apps/question-service
echo "$QUESTION_FIREBASE_JSON" > "./$QUESTION_FIREBASE_CREDENTIAL_PATH"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23.x"
- name: Install Go dependencies
run: |
cd ./apps/question-service
go mod tidy
- name: Install firebase tools
run: curl -sL firebase.tools | bash
- name: Run Go tests with Firebase emulator
run: firebase emulators:exec --only firestore 'cd ./apps/question-service; go test -v ./tests'
frontend-unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup .env
run: |
cd ./apps/frontend
cp .env.example .env
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "22"
- name: Install pnpm
run: npm i -g pnpm
- name: Install dependencies
run: |
cd ./apps/frontend
pnpm i
- name: Run tests
run: |
cd ./apps/frontend
pnpm unit-test
test-webdriver-working:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.1.4
- name: Install dependencies
run: |
cd ./apps/frontend
pnpm i
- name: Install Chrome WebDriver
uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: '130.0.6723.116'
- name: Install Edge
uses: browser-actions/setup-edge@v1
with:
edge-version: stable
- name: Install Geckodriver
uses: browser-actions/setup-geckodriver@latest
- name: Run Browser Test
run: |
cd ./apps/frontend
pnpm browser-test -t "webdriver installed correctly"