Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(43): Add e2e tests with playwright #75

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .env.e2e
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Clone this file into a .env file and populate it with your secrets to start developing with docker

# Prisma
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
DATABASE_URL="postgresql://postgres:password@localhost:5432/peoplez"

# Next Auth
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="secret"

# Stripe keys
STRIPE_PUBLISHABLE_KEY=
STRIPE_PRIVATE_KEY=

# Email sending
EMAIL_SERVER_USER=
EMAIL_SERVER_PASSWORD=
EMAIL_SERVER_HOST=maildev
EMAIL_SERVER_PORT=1025
[email protected]
EMAIL_SECURE=false

# Dev
DEVELOPER=true
12 changes: 11 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ jobs:
env:
SKIP_ENV_VALIDATION: true
DATABASE_URL: postgres://test:test@localhost:5432/db

- name: Unit Test
run: ${{ steps.detect-package-manager.outputs.manager }} run test
env:
SKIP_ENV_VALIDATION: true

- name: Lint Prisma
run: ${{ steps.detect-package-manager.outputs.manager }} run lint:prisma
Expand All @@ -89,4 +94,9 @@ jobs:
env:
DATABASE_URL: postgres://test:test@localhost:5432/db
NEXTAUTH_SECRET: secret
NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_URL: http://localhost:3000

- name: Unit Test Coverage
run: ${{ steps.detect-package-manager.outputs.manager }} run test:coverage
env:
SKIP_ENV_VALIDATION: true
43 changes: 43 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: peoplez
POSTGRESQL_FSYNC: "off"
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install npm
run: npm ci
- name: Copy env
run: cp .env.e2e .env
- name: Do DB migrations
run: npm run db:push
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- 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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
/out/
next-env.d.ts

# coverage
coverage

# production
/build

Expand All @@ -43,3 +46,7 @@ yarn-error.log*

.idea
.vscode

# playwright
playwright-report
test-results
17 changes: 0 additions & 17 deletions jest.config.js

This file was deleted.

Loading
Loading