-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9062618
commit 40e5138
Showing
6 changed files
with
149 additions
and
6 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 |
---|---|---|
|
@@ -55,4 +55,6 @@ Network Trash Folder | |
Temporary Items | ||
.apdisk | ||
|
||
package | ||
package | ||
test-results/ | ||
playwright-report/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,39 @@ | ||
import { defineConfig, devices } from '@playwright/test' | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'html', | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: process.env.NODE_ENV === 'production' ? 'nuxi preview playground' : 'nuxi dev playground', | ||
url: 'http://localhost:3000', | ||
reuseExistingServer: !process.env.CI, | ||
timeout: 120000, | ||
}, | ||
|
||
use: { | ||
baseURL: 'http://localhost:3000', | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
], | ||
}) |
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,8 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { goto, login, reload } from './utils' | ||
|
||
test('should be logged in', async ({ browser }) => { | ||
}) | ||
|
||
test('should refresh session', async ({ browser }) => { | ||
}) |
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,27 @@ | ||
import { type Page, expect } from '@playwright/test' | ||
|
||
export const credentials = { email: '[email protected]', password: 'abc123' } | ||
|
||
export async function goto(page: Page, path: string) { | ||
await page.goto(path) | ||
await expect(page.getByTestId('hydration-check')).toBeAttached() | ||
} | ||
|
||
export async function reload(page: Page) { | ||
await page.reload() | ||
await expect(page.getByTestId('hydration-check')).toBeAttached() | ||
} | ||
|
||
export async function login(page: Page) { | ||
await goto(page, '/auth/login') | ||
await expect(page.getByRole('heading', { name: 'Login' })).toBeVisible() | ||
await page.getByPlaceholder('email').fill(credentials.email) | ||
await page.getByPlaceholder('password').fill(credentials.password) | ||
await page.getByRole('button', { name: 'Login', exact: true }).click() | ||
await expect(page.getByRole('heading', { name: 'Home' })).toBeVisible() | ||
} | ||
|
||
export async function logout(page: Page) { | ||
await page.getByRole('button', { name: 'Logout' }).click() | ||
await expect(page.getByRole('heading', { name: 'Login' })).toBeVisible() | ||
} |