feat(tests): integrate Playwright and Vitest for testing, add CI pipeline, and update dependencies

- Added Playwright configuration for end-to-end testing.
- Integrated Vitest for unit testing with setup files.
- Updated package.json scripts for testing commands.
- Created CI pipeline for automated testing and builds.
- Added various test cases for components and pages.
- Updated .gitignore to exclude Playwright and coverage.
- Enhanced ModsList component with additional class for styling.
This commit is contained in:
taroj1205 2025-05-16 11:15:14 +12:00
parent 966da54a29
commit 133bbc20be
No known key found for this signature in database
GPG key ID: 0FCB6CFFE0981AB7
20 changed files with 2339 additions and 152 deletions

109
.github/workflows/ci-pipeline.yml vendored Normal file
View file

@ -0,0 +1,109 @@
name: CI Pipeline
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node_modules
id: cache-deps
uses: actions/cache@v4
with:
path: |
node_modules
~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
build-check:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: |
node_modules
~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Verify npm installation
run: npm --version
- name: Build project
run: npm run build
biome:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: |
node_modules
~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Run Biome check
run: npx biome check ./src
vitest:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: |
node_modules
~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Run Vitest tests
run: npx vitest run
playwright:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: |
node_modules
~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30

View file

@ -1,28 +0,0 @@
name: PR Build Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Verify npm installation
run: npm --version
- name: Install dependencies
run: npm install --no-frozen-lockfile
- name: Run Biome check
run: npx biome check ./src
- name: Build project
run: npm run build