-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[playwright] feat: Add registration test
- Loading branch information
1 parent
ee22cc6
commit cb37717
Showing
3 changed files
with
35 additions
and
4 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
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
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 { test, expect, Page } from '@playwright/test'; | ||
|
||
let page: Page; | ||
const timeout = 60 * 1000; | ||
const TIMESTAMP = Date.now(); | ||
|
||
test.beforeAll(async ({ browser }, { timeout }) => { | ||
page = await browser.newPage(); | ||
await page.goto('/', { timeout }); | ||
}); | ||
|
||
test('User Registration', async () => { | ||
await page.getByRole('link', { name: 'Sign up' }).click(); | ||
|
||
await expect( | ||
page.getByRole('heading', { name: 'Register new account' }) | ||
).toBeVisible(); | ||
|
||
await page.fill('input[name="username"]', `user${TIMESTAMP}`); | ||
await page.fill('input[name="email"]', `user${TIMESTAMP}@mail.com`); | ||
await page.fill('input[name="password"]', 'auto'); | ||
await page.fill('input[name="confirmPassword"]', 'auto'); | ||
|
||
await page.getByRole('button', { name: 'Register' }).click(); | ||
|
||
/** Free tier on render.com may take 60 seconds to startup */ | ||
|
||
await expect(page.getByText('Account created successfully!')).toBeVisible({ | ||
timeout, | ||
}); | ||
}); |