-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(frontend): homepage basic snapshots (logged in and logged out)
- Loading branch information
1 parent
694dc55
commit 16c84dd
Showing
8 changed files
with
42 additions
and
8 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 |
---|---|---|
|
@@ -40,5 +40,3 @@ backend-v*.wasm.gz | |
/blob-report/ | ||
/playwright/.cache/ | ||
pocket-ic | ||
|
||
e2e/*-snapshots/*Chrome-darwin.png |
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,11 +1,45 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { testWithII } from '@dfinity/internet-identity-playwright'; | ||
import { expect, test, type Page } from '@playwright/test'; | ||
|
||
const testUrl = '/'; | ||
|
||
test('should display not logged in homepage', async ({ page }) => { | ||
await page.goto(testUrl); | ||
const hideHeroAnimation = async (page: Page): Promise<void> => { | ||
await page | ||
.getByTestId('three-background-canvas') | ||
.evaluate((element) => (element.style.display = 'none')); | ||
}; | ||
|
||
await page.getByTestId('login-button').waitFor(); | ||
test.describe('logged out user', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto(testUrl); | ||
|
||
await expect(page).toHaveScreenshot(); | ||
await page.getByTestId('login-button').waitFor(); | ||
}); | ||
|
||
test('should display logged out hero and blurred tokens', async ({ page }) => { | ||
await hideHeroAnimation(page); | ||
|
||
await expect(page).toHaveScreenshot({ | ||
fullPage: true | ||
}); | ||
}); | ||
}); | ||
|
||
testWithII.describe('logged in user', () => { | ||
testWithII.beforeEach(async ({ page, iiPage }) => { | ||
await page.goto(testUrl); | ||
|
||
await iiPage.signInWithNewIdentity(); | ||
|
||
await page.getByTestId('exchange-balance-output').waitFor(); | ||
await page.getByTestId('tokens-skeletons-initialized').waitFor(); | ||
}); | ||
|
||
testWithII('should display logged in hero and tokens', async ({ page }) => { | ||
await hideHeroAnimation(page); | ||
|
||
await expect(page).toHaveScreenshot({ | ||
fullPage: true | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+44 KB
...ged-in-user-should-display-logged-in-hero-and-tokens-1-Google-Chrome-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+79.3 KB
...er-should-display-logged-out-hero-and-blurred-tokens-1-Google-Chrome-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-52.6 KB
...ec.ts-snapshots/should-display-not-logged-in-homepage-1-Google-Chrome-linux.png
Binary file not shown.
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