workflow updated for new test suits #16
Workflow file for this run
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: Playwright Tests | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
playwright: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
services: | |
mongodb: | |
image: mongo:5.0 | |
ports: | |
- 27018:27017 # Mapping port 27018 on the host to 27017 in the container | |
options: >- | |
--health-cmd="mongo --eval 'db.adminCommand({ ping: 1 })' --quiet" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install server dependencies | |
working-directory: ./server | |
run: npm install | |
- name: Start the project server | |
working-directory: ./server | |
run: | | |
echo "Starting the server from the /server folder..." | |
npm start & | |
echo "Waiting for the server to be ready..." | |
while ! nc -z localhost 8000; do | |
echo "Waiting for server..." | |
sleep 5 | |
done | |
env: | |
MONGODB_URI_LOCAL: mongodb://127.0.0.1:27018/gameZonex | |
JWT_SECRET: gameZonex | |
- name: Install dependencies | |
working-directory: ./client | |
run: npm ci | |
- name: Install Playwright Browsers | |
working-directory: ./client | |
run: npx playwright install --with-deps | |
- name: Run the client project | |
working-directory: ./client | |
run: | | |
echo "Starting Vite dev server in the background..." | |
npm run dev & | |
echo "Waiting for Vite server to be ready..." | |
while ! nc -z localhost 5173; do | |
sleep 5 | |
done | |
- name: Run Playwright tests | |
working-directory: ./client | |
run: npx playwright test | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |