Skip to content

Commit

Permalink
[SUPPORT] : Fix unstable sceenshots on ethereumStacking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcayuelas-ledger committed Aug 2, 2024
1 parent c94d878 commit a82a6c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-panthers-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Fix unstable integration test
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ test("Ethereum staking flows via portfolio, asset page and market page @smoke",
const marketCoinPage = new MarketCoinPage(page);
const analytics = new Analytics(page);

const maskItemsInMarket = {
mask: [
page.getByTestId("market-small-graph"),
page.getByTestId("market-coin-price"),
page.getByTestId("market-cap"),
page.getByTestId("market-price-change"),
page.getByRole("row").filter({ hasText: new RegExp("^(?!.*(?:Bitcoin|Ethereum)).*$") }),
],
};

const maskPartOfItemsInMarket = {
mask: [page.getByRole("row").filter({ hasText: new RegExp("^(?!.*(?:Bitcoin|Ethereum)).*$") })],
};

await test.step("Entry buttons load with feature flag enabled", async () => {
await expect.soft(page).toHaveScreenshot("portfolio-entry-buttons.png", {
mask: [layout.marketPerformanceWidget],
Expand Down Expand Up @@ -150,16 +164,6 @@ test("Ethereum staking flows via portfolio, asset page and market page @smoke",
});

await test.step("Market page loads with ETH staking available", async () => {
const maskItemsInMarket = {
mask: [
page.getByTestId("market-small-graph"),
page.getByTestId("market-coin-price"),
page.getByTestId("market-cap"),
page.getByTestId("market-price-change"),
page.getByRole("row").filter({ hasText: new RegExp("^(?!.*(?:Bitcoin|Ethereum)).*$") }),
],
};

await layout.goToMarket();
await marketPage.waitForLoading();
await expect
Expand All @@ -170,7 +174,9 @@ test("Ethereum staking flows via portfolio, asset page and market page @smoke",
await test.step("start stake flow via Stake entry button", async () => {
await marketPage.startStakeFlowByTicker("eth");
await drawer.waitForDrawerToBeVisible();
await expect.soft(page).toHaveScreenshot("stake-drawer-opened-from-market-page.png");
await expect
.soft(page)
.toHaveScreenshot("stake-drawer-opened-from-market-page.png", maskPartOfItemsInMarket);

Check failure on line 179 in apps/ledger-live-desktop/tests/specs/services/ethereumStaking.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/services/ethereumStaking.spec.ts:67:5 › Ethereum staking flows via portfolio

3) [mocked_tests] › specs/services/ethereumStaking.spec.ts:67:5 › Ethereum staking flows via portfolio, asset page and market page @smoke › start stake flow via Stake entry button Error: Screenshot comparison failed: 268657 pixels (ratio 0.35 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/services/ethereumStaking.spec.ts-snapshots/stake-drawer-opened-from-market-page-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/services-ethereumStaking-E-30b12--page-and-market-page-smoke-mocked-tests/stake-drawer-opened-from-market-page-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/services-ethereumStaking-E-30b12--page-and-market-page-smoke-mocked-tests/stake-drawer-opened-from-market-page-diff.png Call log: - expect.soft.toHaveScreenshot(stake-drawer-opened-from-market-page.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 268657 pixels (ratio 0.35 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 - 268657 pixels (ratio 0.35 of all image pixels) are different. 177 | await expect 178 | .soft(page) > 179 | .toHaveScreenshot("stake-drawer-opened-from-market-page.png", maskPartOfItemsInMarket); | ^ 180 | await drawer.close(); 181 | }); 182 | at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/services/ethereumStaking.spec.ts:179:8 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/services/ethereumStaking.spec.ts:174:3
await drawer.close();
});

Expand Down

0 comments on commit a82a6c4

Please sign in to comment.