Skip to content

Commit

Permalink
Added Playwright selfhost tests and e2e spec for new install process
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-murakami committed Jan 27, 2024
1 parent 935b41d commit e4879c8
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/playwright_selfhost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Playwright Selfhost Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Create .env file
run: cp .env.e2e .env
- name: Install dependencies
run: npm install -g pnpm && pnpm install
- name: Build Frontend App
run: pnpm build:e2e
- name: docker compose run
run: docker-compose up -d
- name: Run Playwright tests
run: pnpm exec playwright test self-host.spec.ts
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
31 changes: 31 additions & 0 deletions e2e/self-host.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import util from 'node:util'

const exec = util.promisify(require('node:child_process').exec)
import { test, expect } from '@playwright/test'

test.beforeAll(async () => {
await exec('pnpm db:truncate')
})

test.describe('new install', () => {
test('show siginup page and create user, finally showing Dashboard page', async ({
page,
}) => {
await page.goto('http://localhost:3000/')
await expect(page.getByTestId('signup-page')).toBeVisible()
await expect(page.getByTestId('signup-page')).toHaveText(/Signup/)

// input signup form
await page.getByTestId('signup-name-input').fill('newTransitionBloger')
await page.getByTestId('signup-password-input').fill('superstroingpassword')
// sbumit
await page.getByTestId('signup-submit-btn').click()
// pageTransition /dashboard
await expect(page).toHaveURL('http://localhost:3000/dashboard')
await expect(page.locator('main h1')).toHaveText(/Dashboard/)
})
})

test.afterAll(async () => {
await exec('pnpm db:reset')
})

0 comments on commit e4879c8

Please sign in to comment.