-
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
13 changed files
with
189 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Appointment E2E Test Configuration | ||
|
||
# Production sign-in (FxA) credentials | ||
APPT_PROD_LOGIN_EMAIL= | ||
APPT_PROD_LOGIN_PWORD= |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.env | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ Guide for running the E2E tests. | |
## Installation | ||
|
||
todo | ||
include npm install . etc | ||
|
||
```bash | ||
todo | ||
|
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
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,17 @@ | ||
import { expect, type Page, type Locator } from '@playwright/test'; | ||
|
||
export class DashboardPage { | ||
readonly page: Page; | ||
readonly navBarDashboardBtn: Locator; | ||
readonly userMenuAvatar: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
// temporary; update after next deployment when my test-dataid's are deployed | ||
//this.navBarDashboardBtn = this.page.getByTestId('nav-bar-dashboard-button'); | ||
this.navBarDashboardBtn = this.page.getByRole('link', { name: 'Dashboard' }); | ||
// temporary; update after next deployment when my test-dataid's are deployed | ||
//this.userMenuAvatar = this.page.getByTestId('user-menu-avatar'); | ||
this.userMenuAvatar = this.page.locator('.flex-center'); | ||
} | ||
} |
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,24 @@ | ||
import { expect, type Page, type Locator } from '@playwright/test'; | ||
import { PROD_LOGIN_PWORD } from '../const/constants'; | ||
|
||
export class FxAPage { | ||
readonly page: Page; | ||
readonly signInHeaderText: Locator; | ||
readonly userAvatar: Locator; | ||
readonly passwordInput: 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.passwordInput = this.page.getByRole('textbox', {name: 'password' }); | ||
this.signInButton = this.page.getByRole('button', { name: 'Sign in' }); | ||
} | ||
|
||
async signIn() { | ||
expect(PROD_LOGIN_PWORD, 'getting APPT_PROD_LOGIN_PWORD env var').toBeTruthy(); | ||
await this.passwordInput.fill(String(PROD_LOGIN_PWORD)); | ||
await this.signInButton.click(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,18 +1,51 @@ | ||
import { type Page, type Locator } from '@playwright/test'; | ||
import { APPT_PROD_URL } from '../const/constants'; | ||
import { expect, type Page, type Locator } from '@playwright/test'; | ||
import { APPT_PROD_URL, PROD_LOGIN_EMAIL, FXA_PAGE_TITLE } from '../const/constants'; | ||
|
||
export class SplashscreenPage { | ||
readonly page: Page; | ||
readonly loginBtn: Locator; | ||
readonly signUpBetaBtn: Locator; | ||
readonly loginEmailInput: Locator; | ||
readonly loginContinueBtn: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.loginBtn = this.page.getByTestId('home-login-btn'); | ||
this.signUpBetaBtn = this.page.getByTestId('home-sign-up-beta-btn'); | ||
//update this after data-testid 's are deployed to prod | ||
//this.loginBtn = this.page.getByTestId('home-login-btn'); | ||
this.loginBtn = this.page.getByTitle('Log in'); | ||
//update this after data-testid 's are deployed to prod | ||
//this.signUpBetaBtn = this.page.getByTestId('home-sign-up-beta-btn'); | ||
this.signUpBetaBtn = this.page.getByTitle('Sign up for the beta'); | ||
//update this after data-testid 's are deployed to prod | ||
//this.loginEmailInput = this.page.getByTestId('login-email-input'); | ||
this.loginEmailInput = this.page.getByLabel('Email address'); | ||
//update this after data-testid 's are deployed to prod | ||
//this.loginContinueBtn = this.page.getByTestId('login-continue-btn'); | ||
this.loginContinueBtn = this.page.getByTitle('Continue'); | ||
} | ||
|
||
async gotoProd() { | ||
await this.page.goto(APPT_PROD_URL); | ||
} | ||
|
||
async clickLoginBtn() { | ||
await this.loginBtn.click(); | ||
} | ||
|
||
async enterLoginEmail(emailAddress: string) { | ||
await this.loginEmailInput.fill(emailAddress); | ||
} | ||
|
||
async clickLoginContinueBtn() { | ||
await this.loginContinueBtn.click(); | ||
} | ||
|
||
async getToFxA() { | ||
await expect(this.loginBtn).toBeVisible(); | ||
await this.clickLoginBtn(); | ||
expect(PROD_LOGIN_EMAIL, 'getting APPT_PROD_LOGIN_EMAIL env var').toBeTruthy(); | ||
await this.enterLoginEmail(String(PROD_LOGIN_EMAIL)) | ||
await this.clickLoginContinueBtn(); | ||
await expect(this.page).toHaveTitle(FXA_PAGE_TITLE, { timeout: 30_000 }); // be generous in case FxA is slow to load | ||
} | ||
} |
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,44 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { SplashscreenPage } from '../pages/splashscreen-page'; | ||
import { FxAPage } from '../pages/fxa-page'; | ||
import { FXA_PAGE_TITLE, APPT_PAGE_TITLE } from '../const/constants'; | ||
import { DashboardPage } from '../pages/dashboard-page'; | ||
|
||
let splashscreen: SplashscreenPage; | ||
let fxa_sign_in: FxAPage; | ||
let dashboard_page: DashboardPage; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
// navigate to the main appointment page (splashscreen) | ||
splashscreen = new SplashscreenPage(page); | ||
fxa_sign_in = new FxAPage(page); | ||
dashboard_page = new DashboardPage(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 splashscreen.getToFxA(); | ||
await expect(fxa_sign_in.userAvatar).toBeVisible({ timeout: 30_000}); // generous time for fxa to appear | ||
await expect(fxa_sign_in.signInButton).toBeVisible(); | ||
}); | ||
|
||
test('able to sign-in to appointment via fxa', async ({ page }) => { | ||
await splashscreen.getToFxA(); | ||
await expect(fxa_sign_in.signInHeaderText).toBeVisible({ timeout: 30_000 }); | ||
await fxa_sign_in.signIn(); | ||
await expect(page).toHaveTitle(APPT_PAGE_TITLE, { timeout: 30_000 }); // give generous time for fxa sign to complete | ||
await expect(dashboard_page.userMenuAvatar).toBeVisible({ timeout: 30_000 }); | ||
await expect(dashboard_page.navBarDashboardBtn).toBeVisible({ timeout: 30_000 }); | ||
}); | ||
}); |
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,30 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { SplashscreenPage } from '../pages/splashscreen-page'; | ||
import { FxAPage } from '../pages/fxa-page'; | ||
import { DashboardPage } from '../pages/dashboard-page'; | ||
|
||
let splashscreen: SplashscreenPage; | ||
let fxa_sign_in: FxAPage; | ||
let dashboard_page: DashboardPage; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
// navigate to the main appointment page (splashscreen) and sign-in via fxa | ||
splashscreen = new SplashscreenPage(page); | ||
fxa_sign_in = new FxAPage(page); | ||
dashboard_page = new DashboardPage(page); | ||
await splashscreen.gotoProd(); | ||
await splashscreen.getToFxA(); | ||
await expect(fxa_sign_in.signInHeaderText).toBeVisible({ timeout: 30_000 }); | ||
await fxa_sign_in.signIn(); | ||
await expect(dashboard_page.userMenuAvatar).toBeVisible({ timeout: 30_000 }); | ||
}); | ||
|
||
// verify basic sign-out flow works | ||
test.describe('basic sign-out flow', { | ||
tag: '@prod-sanity' | ||
}, () => { | ||
test('able to log out of appointment', async ({ page }) => { | ||
// todo: logout, verify back on splashscreen page | ||
expect(true).toBeTruthy(); | ||
}); | ||
}); |