-
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
Showing
6 changed files
with
119 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,15 @@ | ||
import { type Page, type Locator } from '@playwright/test'; | ||
|
||
export class FxAPage { | ||
readonly page: Page; | ||
readonly signInHeaderText: Locator; | ||
readonly userAvatar: Locator; | ||
readonly signInButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.signInHeaderText = this.page.getByText('Enter your password'); | ||
this.userAvatar = this.page.getByTestId('avatar-default'); | ||
this.signInButton = this.page.locator('button:text("Sign in")'); | ||
} | ||
} |
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,46 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { SplashscreenPage } from '../pages/splashscreen-page'; | ||
import { FxAPage } from '../pages/fxa-page'; | ||
import { PROD_LOGIN_EMAIL, FXA_PAGE_TITLE } from '../const/constants'; | ||
|
||
let splashscreen: SplashscreenPage; | ||
let fxa_sign_in: FxAPage; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
// navigate to the main appointment page (splashscreen) | ||
splashscreen = new SplashscreenPage(page); | ||
fxa_sign_in = new FxAPage(page); | ||
await splashscreen.gotoProd(); | ||
}); | ||
|
||
// verify basic sign-in flow works | ||
test.describe('basic sign-in flow', { | ||
tag: '@prod-sanity' | ||
}, () => { | ||
test('clicking login button brings up the sign-in dialog', async ({ page }) => { | ||
await expect(splashscreen.loginBtn).toBeVisible(); | ||
await splashscreen.clickLoginBtn(); | ||
await expect(splashscreen.loginEmailInput).toBeVisible(); | ||
await expect(splashscreen.loginContinueBtn).toBeVisible(); | ||
}); | ||
|
||
test('clicking continue button on login dialog brings up the FxA sign-in dialog', async ({ page }) => { | ||
await expect(splashscreen.loginBtn).toBeVisible(); | ||
await splashscreen.clickLoginBtn(); | ||
expect(PROD_LOGIN_EMAIL, 'getting APPT_PROD_LOGIN_EMAIL env var').toBeTruthy(); | ||
await splashscreen.enterLoginEmail(String(PROD_LOGIN_EMAIL)) | ||
await splashscreen.clickLoginContinueBtn(); | ||
await expect(page).toHaveTitle(FXA_PAGE_TITLE); | ||
await expect(fxa_sign_in.signInHeaderText).toBeVisible({ timeout: 30_000 }); // be generous in case FxA is slow to load | ||
await expect(fxa_sign_in.userAvatar).toBeVisible(); | ||
await expect(fxa_sign_in.signInButton).toBeVisible(); | ||
}); | ||
|
||
// todo fill out sign-in dialog etc. use the splashscreen-page object model is fine | ||
test('able to sign-in to appointment', async ({ page }) => { | ||
// todo fill out email address field, password field, and click continue button | ||
// => use credentials set via local env vars (will set via secrets in CI) | ||
// add a splashscreen.signOut() and use that; then verify here (dashbaord appears) | ||
expect(true).toBeTruthy(); | ||
}); | ||
}); |
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, expect } from '@playwright/test'; | ||
import { SplashscreenPage } from '../pages/splashscreen-page'; | ||
import { APPT_PAGE_TITLE } from '../const/constants'; | ||
|
||
let splashscreen: SplashscreenPage; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
// navigate to the main appointment page (splashscreen) | ||
splashscreen = new SplashscreenPage(page); | ||
await splashscreen.gotoProd(); | ||
// todo fill out email address field, password field, and click continue button | ||
// => use credentials set via local env vars (will set via secrets in CI) | ||
// then verifiy sign-in was successful - dashboard appears | ||
// use splashscreen-page signOn() method | ||
}); | ||
|
||
// verify main appointment splash screen appears correctly | ||
test.describe('basic sign-out flow', { | ||
tag: '@prod-sanity' | ||
}, () => { | ||
test('able to sign-out of appointment', async ({ page }) => { | ||
// todo sign out and verify splashscreen appears with login button visible | ||
expect(true).toBeTruthy(); | ||
}); | ||
}); |