Skip to content

Commit

Permalink
Single test for sign/in out
Browse files Browse the repository at this point in the history
  • Loading branch information
rwood-moz committed Dec 13, 2024
1 parent c5e68c3 commit e676e21
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 41 deletions.
4 changes: 2 additions & 2 deletions test/e2e/browserstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ platforms:
osVersion: Sequoia
browserName: playwright-firefox
browserVersion: latest
- os: Windows
osVersion: 11
- os: OS X
osVersion: Sequoia
browserName: playwright-chromium
browserVersion: latest

Expand Down
4 changes: 3 additions & 1 deletion test/e2e/pages/dashboard-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ export class DashboardPage {
readonly navBarDashboardBtn: Locator;
readonly userMenuAvatar: Locator;
readonly logOutMenuItem: Locator;
readonly shareMyLink: Locator;

constructor(page: Page) {
this.page = page;
this.navBarDashboardBtn = this.page.getByRole('link', { name: 'Dashboard' });
this.userMenuAvatar = this.page.getByTestId('user-menu-avatar');
this.logOutMenuItem = this.page.getByTestId('user-nav-logout-menu');
this.shareMyLink = this.page.getByTestId('dashboard-share-quick-link-btn');
}

async logOut() {
async signOut() {
await expect(this.userMenuAvatar).toBeVisible();
await this.userMenuAvatar.click();
await expect(this.logOutMenuItem).toBeVisible();
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default defineConfig({
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : 1, // actualy don't run in parallel locally either, for now
// Tests will timeout if still running after this time (ms)
timeout: 3 * 60 * 1000,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [['list']],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand Down
20 changes: 14 additions & 6 deletions test/e2e/tests/sign-in.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@ test.beforeEach(async ({ page }) => {
await splashscreen.gotoProd();
});

// verify basic sign-in flow works
test.describe('sign-in flow', {
// verify basic sign-in and sign-out flow works
test.describe('sign-in and sign-out flow', {
tag: '@prod-sanity'
}, () => {
test('able to sign-in to appointment via fxa', async ({ page }) => {
test('able to sign-in and out of appointment via fxa', async ({ page }) => {
await splashscreen.getToFxA();
await expect(fxa_sign_in.signInHeaderText).toBeVisible({ timeout: 30_000 });
await expect(fxa_sign_in.userAvatar).toBeVisible({ timeout: 30_000}); // generous time for fxa to appear
await expect(fxa_sign_in.signInHeaderText).toBeVisible({ timeout: 30_000 }); // generous time for fxa to appear
await expect(fxa_sign_in.userAvatar).toBeVisible({ timeout: 30_000});
await expect(fxa_sign_in.signInButton).toBeVisible();
await fxa_sign_in.signIn();
await expect(page).toHaveTitle(APPT_PAGE_TITLE, { timeout: 30_000 }); // give generous time for fxa sign to complete

await page.waitForLoadState('domcontentloaded');

await expect(page).toHaveTitle(APPT_PAGE_TITLE, { timeout: 30_000 }); // give generous time for fxa sign-in
await expect(dashboard_page.userMenuAvatar).toBeVisible({ timeout: 30_000 });
await expect(dashboard_page.navBarDashboardBtn).toBeVisible({ timeout: 30_000 });
await expect(dashboard_page.shareMyLink).toBeVisible({ timeout: 30_000 });

await dashboard_page.signOut();
await expect(page).toHaveTitle(APPT_PAGE_TITLE, { timeout: 30_000 }); // generous time for fxa sign-out
await expect(splashscreen.loginBtn).toBeVisible({ timeout: 30_000 });
});
});
32 changes: 0 additions & 32 deletions test/e2e/tests/sign-out.spec.ts

This file was deleted.

0 comments on commit e676e21

Please sign in to comment.