-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: wip persist osm login across playwright tests
- Loading branch information
1 parent
e424693
commit 8cb79db
Showing
6 changed files
with
48 additions
and
22 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 |
---|---|---|
|
@@ -122,5 +122,5 @@ dist | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
|
||
playwright/.auth | ||
/e2e/.cache/ | ||
e2e/.auth |
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,25 @@ | ||
import { test as setup, expect } from '@playwright/test'; | ||
import path from 'path'; | ||
|
||
const authFile = path.join(__dirname, './.auth/user.json'); | ||
|
||
setup('authenticate', async ({ page }) => { | ||
// Navigate to the app's base URL | ||
await page.goto('/'); | ||
await page.getByRole('button', { name: 'Sign in' }).click(); | ||
|
||
// Select OSM login | ||
await page.getByText('Personal OSM Account').click(); | ||
await page.waitForSelector('text=Log in to OpenStreetMap'); | ||
|
||
// OSM Login page | ||
await page.getByLabel('Email Address or Username').fill(process.env.OSM_USERNAME || 'username'); | ||
await page.getByLabel('Password').fill(process.env.OSM_PASSWORD || 'password'); | ||
await page.getByRole('button', { name: 'Log in' }).click(); | ||
|
||
// Wait for redirect and valid login (sign out button) | ||
await page.waitForSelector('text=Sign Out'); | ||
|
||
// Save authentication state | ||
await page.context().storageState({ path: authFile }); | ||
}); |
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