Skip to content

Commit

Permalink
test: fix mask and some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abdurrahman-ledger committed Jul 4, 2024
1 parent 1a18d9b commit 4839315
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function MarketPerformanceWidgetContainer({
}}
py={"23px"}
grow
data-test-id="market-performance-widget"
>
<MarketPerformanceWidgetHeader order={order} onChangeOrder={setOrder} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function Logo({
alignItems="center"
justifyContent="center"
backgroundColor={isLoaded ? "transparent" : "neutral.c50"}
data-test-id="live-icon-container"
>
{!isLoaded && <Text>{name[0].toUpperCase()}</Text>}

Expand Down
2 changes: 2 additions & 0 deletions apps/ledger-live-desktop/tests/component/layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export class Layout extends Component {
readonly appUpdateBanner = this.page.getByTestId("layout-app-update-banner");
// }

readonly marketPerformanceWidget = this.page.getByTestId("market-performance-widget");

@step("Go to Portfolio")
async goToPortfolio() {
await this.drawerPortfolioButton.click();
Expand Down
12 changes: 6 additions & 6 deletions apps/ledger-live-desktop/tests/specs/general/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ test("Layout @smoke", async ({ page }) => {
await test.step("can toggle discreet mode", async () => {
await layout.goToPortfolio(); // FIXME: remove this line when LL-8899 is fixed
await layout.toggleDiscreetMode();
await expect
.soft(page)
.toHaveScreenshot("discreet-mode.png", { mask: [page.locator("canvas")] });
await expect.soft(page).toHaveScreenshot("discreet-mode.png", {

Check failure on line 69 in apps/ledger-live-desktop/tests/specs/general/layout.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/general/layout.spec.ts:11:5 › Layout @smoke

1) [mocked_tests] › specs/general/layout.spec.ts:11:5 › Layout @smoke ──────────────────────────── Error: Screenshot comparison failed: 134681 pixels (ratio 0.18 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/layout.spec.ts-snapshots/discreet-mode-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-layout-Layout-smoke-mocked-tests/discreet-mode-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-layout-Layout-smoke-mocked-tests/discreet-mode-diff.png Call log: - expect.soft.toHaveScreenshot(discreet-mode.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 134681 pixels (ratio 0.18 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 134681 pixels (ratio 0.18 of all image pixels) are different. 67 | await layout.goToPortfolio(); // FIXME: remove this line when LL-8899 is fixed 68 | await layout.toggleDiscreetMode(); > 69 | await expect.soft(page).toHaveScreenshot("discreet-mode.png", { | ^ 70 | mask: [page.locator("canvas"), layout.marketPerformanceWidget], 71 | }); 72 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/layout.spec.ts:69:29 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/layout.spec.ts:66:3
mask: [page.locator("canvas"), layout.marketPerformanceWidget],
});
});

await test.step("can collapse the main sidebar", async () => {
await layout.drawerCollapseButton.click();
await expect
.soft(page)
.toHaveScreenshot("collapse-sidebar.png", { mask: [page.locator("canvas")] });
await expect.soft(page).toHaveScreenshot("collapse-sidebar.png", {

Check failure on line 76 in apps/ledger-live-desktop/tests/specs/general/layout.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/general/layout.spec.ts:11:5 › Layout @smoke

1) [mocked_tests] › specs/general/layout.spec.ts:11:5 › Layout @smoke ──────────────────────────── Error: Screenshot comparison failed: 138132 pixels (ratio 0.18 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/layout.spec.ts-snapshots/collapse-sidebar-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-layout-Layout-smoke-mocked-tests/collapse-sidebar-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-layout-Layout-smoke-mocked-tests/collapse-sidebar-diff.png Call log: - expect.soft.toHaveScreenshot(collapse-sidebar.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 138132 pixels (ratio 0.18 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 138132 pixels (ratio 0.18 of all image pixels) are different. 74 | await test.step("can collapse the main sidebar", async () => { 75 | await layout.drawerCollapseButton.click(); > 76 | await expect.soft(page).toHaveScreenshot("collapse-sidebar.png", { | ^ 77 | mask: [page.locator("canvas"), layout.marketPerformanceWidget], 78 | }); 79 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/layout.spec.ts:76:29 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/layout.spec.ts:74:3
mask: [page.locator("canvas"), layout.marketPerformanceWidget],
});
});

await test.step("can display the help modal", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ test("Portfolio @smoke", async ({ page }) => {

await test.step("load portfolio", async () => {
await layout.totalBalance.waitFor({ state: "visible" });
await expect.soft(page).toHaveScreenshot("portfolio.png");
await expect.soft(page).toHaveScreenshot("portfolio.png", {

Check failure on line 14 in apps/ledger-live-desktop/tests/specs/general/portfolio.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/general/portfolio.spec.ts:8:5 › Portfolio @smoke

2) [mocked_tests] › specs/general/portfolio.spec.ts:8:5 › Portfolio @smoke › load portfolio ────── Error: Screenshot comparison failed: 134681 pixels (ratio 0.18 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/portfolio.spec.ts-snapshots/portfolio-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-portfolio-Portfolio-smoke-mocked-tests/portfolio-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-portfolio-Portfolio-smoke-mocked-tests/portfolio-diff.png Call log: - expect.soft.toHaveScreenshot(portfolio.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 134681 pixels (ratio 0.18 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 134681 pixels (ratio 0.18 of all image pixels) are different. 12 | await test.step("load portfolio", async () => { 13 | await layout.totalBalance.waitFor({ state: "visible" }); > 14 | await expect.soft(page).toHaveScreenshot("portfolio.png", { | ^ 15 | mask: [layout.marketPerformanceWidget], 16 | }); 17 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/portfolio.spec.ts:14:29 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/portfolio.spec.ts:12:3
mask: [layout.marketPerformanceWidget],
});
});

await test.step(`scroll to operations`, async () => {
Expand Down
20 changes: 10 additions & 10 deletions apps/ledger-live-desktop/tests/specs/general/updater.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ test("Updater", async ({ page }) => {

await test.step("[idle] state should not be visible", async () => {
await expect(layout.appUpdateBanner).toBeHidden();
await expect
.soft(page)
.toHaveScreenshot("app-updater-idle.png", { mask: [page.locator("canvas")] });
await expect.soft(page).toHaveScreenshot("app-updater-idle.png", {

Check failure on line 17 in apps/ledger-live-desktop/tests/specs/general/updater.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/general/updater.spec.ts:11:5 › Updater

3) [mocked_tests] › specs/general/updater.spec.ts:11:5 › Updater ───────────────────────────────── Error: Screenshot comparison failed: 134681 pixels (ratio 0.18 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts-snapshots/app-updater-idle-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-updater-Updater-mocked-tests/app-updater-idle-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-updater-Updater-mocked-tests/app-updater-idle-diff.png Call log: - expect.soft.toHaveScreenshot(app-updater-idle.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 134681 pixels (ratio 0.18 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 134681 pixels (ratio 0.18 of all image pixels) are different. 15 | await test.step("[idle] state should not be visible", async () => { 16 | await expect(layout.appUpdateBanner).toBeHidden(); > 17 | await expect.soft(page).toHaveScreenshot("app-updater-idle.png", { | ^ 18 | mask: [page.locator("canvas"), layout.marketPerformanceWidget], 19 | }); 20 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts:17:29 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts:15:3
mask: [page.locator("canvas"), layout.marketPerformanceWidget],
});
});

await test.step("[checking] state should be visible", async () => {
await appUpdater.setStatus("checking");
await expect
.soft(page)
.toHaveScreenshot("app-updater-layout.png", { mask: [page.locator("canvas")] });
await expect.soft(page).toHaveScreenshot("app-updater-layout.png", {

Check failure on line 24 in apps/ledger-live-desktop/tests/specs/general/updater.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/general/updater.spec.ts:11:5 › Updater

3) [mocked_tests] › specs/general/updater.spec.ts:11:5 › Updater ───────────────────────────────── Error: Screenshot comparison failed: 130004 pixels (ratio 0.17 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts-snapshots/app-updater-layout-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-updater-Updater-mocked-tests/app-updater-layout-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-updater-Updater-mocked-tests/app-updater-layout-diff.png Call log: - expect.soft.toHaveScreenshot(app-updater-layout.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 130004 pixels (ratio 0.17 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 130004 pixels (ratio 0.17 of all image pixels) are different. 22 | await test.step("[checking] state should be visible", async () => { 23 | await appUpdater.setStatus("checking"); > 24 | await expect.soft(page).toHaveScreenshot("app-updater-layout.png", { | ^ 25 | mask: [page.locator("canvas"), layout.marketPerformanceWidget], 26 | }); 27 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts:24:29 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts:22:3
mask: [page.locator("canvas"), layout.marketPerformanceWidget],
});
});

await test.step("[check-success] state should be visible", async () => {
Expand All @@ -43,16 +43,16 @@ test("Updater", async ({ page }) => {

await test.step("[error] state should be visible", async () => {
await appUpdater.setStatus("error");
await expect
.soft(page)
.toHaveScreenshot("app-updater-error-with-carousel.png", { mask: [page.locator("canvas")] });
await expect.soft(page).toHaveScreenshot("app-updater-error-with-carousel.png", {

Check failure on line 46 in apps/ledger-live-desktop/tests/specs/general/updater.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/general/updater.spec.ts:11:5 › Updater

3) [mocked_tests] › specs/general/updater.spec.ts:11:5 › Updater ───────────────────────────────── Error: Screenshot comparison failed: 130004 pixels (ratio 0.17 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts-snapshots/app-updater-error-with-carousel-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-updater-Updater-mocked-tests/app-updater-error-with-carousel-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-updater-Updater-mocked-tests/app-updater-error-with-carousel-diff.png Call log: - expect.soft.toHaveScreenshot(app-updater-error-with-carousel.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 130004 pixels (ratio 0.17 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 130004 pixels (ratio 0.17 of all image pixels) are different. 44 | await test.step("[error] state should be visible", async () => { 45 | await appUpdater.setStatus("error"); > 46 | await expect.soft(page).toHaveScreenshot("app-updater-error-with-carousel.png", { | ^ 47 | mask: [page.locator("canvas"), layout.marketPerformanceWidget], 48 | }); 49 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts:46:29 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts:44:3
mask: [page.locator("canvas"), layout.marketPerformanceWidget],
});
});

await test.step("[error] state (any) should be visible, without the carousel", async () => {
await layout.goToPortfolio();
await layout.appUpdateBanner.isVisible();
await expect.soft(page).toHaveScreenshot("app-updater-error-without-carousel.png", {

Check failure on line 54 in apps/ledger-live-desktop/tests/specs/general/updater.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/general/updater.spec.ts:11:5 › Updater

3) [mocked_tests] › specs/general/updater.spec.ts:11:5 › Updater ───────────────────────────────── Error: Screenshot comparison failed: 130004 pixels (ratio 0.17 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts-snapshots/app-updater-error-without-carousel-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-updater-Updater-mocked-tests/app-updater-error-without-carousel-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/general-updater-Updater-mocked-tests/app-updater-error-without-carousel-diff.png Call log: - expect.soft.toHaveScreenshot(app-updater-error-without-carousel.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 130004 pixels (ratio 0.17 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 130004 pixels (ratio 0.17 of all image pixels) are different. 52 | await layout.goToPortfolio(); 53 | await layout.appUpdateBanner.isVisible(); > 54 | await expect.soft(page).toHaveScreenshot("app-updater-error-without-carousel.png", { | ^ 55 | mask: [page.locator("canvas"), layout.marketPerformanceWidget], 56 | }); 57 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts:54:29 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/general/updater.spec.ts:51:3
mask: [page.locator("canvas")],
mask: [page.locator("canvas"), layout.marketPerformanceWidget],
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import padStart from "lodash/padStart";

test.use({
userdata: "2_accounts_eth_with_tokens_and_nft",
featureFlags: { nftsFromSimplehash: { enabled: false } },
});

test("Custom image (with populated NFT gallery)", async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test("PostOnboarding state logic", async ({ page }) => {
await expect(page).toHaveScreenshot(
`${generateScreenshotPrefix()}postonboarding-banner-in-dashboard.png`,
{
mask: [page.locator("canvas")],
mask: [page.locator("canvas"), layout.marketPerformanceWidget],
},
);
});
Expand Down Expand Up @@ -93,7 +93,7 @@ test("PostOnboarding state logic", async ({ page }) => {
await expect(page).toHaveScreenshot(
`${generateScreenshotPrefix()}postonboarding-done-no-banner-in-dashboard.png`,
{
mask: [page.locator("canvas")],
mask: [page.locator("canvas"), layout.marketPerformanceWidget],
},
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ test("Ethereum staking flows via portfolio, asset page and market page @smoke",
const analytics = new Analytics(page);

await test.step("Entry buttons load with feature flag enabled", async () => {
await expect.soft(page).toHaveScreenshot("portfolio-entry-buttons.png");
await expect.soft(page).toHaveScreenshot("portfolio-entry-buttons.png", {
mask: [layout.marketPerformanceWidget],
});
});

await test.step("start stake flow via Stake entry button", async () => {
Expand Down

0 comments on commit 4839315

Please sign in to comment.