-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Playwright selfhost tests and e2e spec for new install process
- Loading branch information
1 parent
935b41d
commit e4879c8
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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') | ||
}) |