Skip to content

Commit

Permalink
fix: remove filters test
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuciulinaru committed Jul 15, 2024
1 parent b8daecb commit 1a3759b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 82 deletions.
23 changes: 1 addition & 22 deletions apps/ledger-live-desktop/tests/page/swap.page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { waitFor } from "../utils/waitFor";
import { AppPage } from "tests/page/abstractClasses";
import { waitFor } from "../utils/waitFor";

export class SwapPage extends AppPage {
private swapMenuButton = this.page.getByTestId("drawer-swap-button"); // TODO: Should this be here?
Expand Down Expand Up @@ -112,22 +112,6 @@ export class SwapPage extends AppPage {
await this.customFeeTextbox.fill(amount);
}

async filterByCentralisedQuotes() {
await this.centralisedQuoteFilterButton.click();
}

async filterByDecentralisedQuotes() {
await this.decentralisedQuoteFilterButton.click();
}

async filterByFloatingRateQuotes() {
await this.floatQuoteFilterButton.click();
}

async filterByFixedRateQuotes() {
await this.fixedQuoteFilterButton.click();
}

async selectExchangeQuote(
providerName: "changelly" | "cic" | "oneinch" | "paraswap",
exchangeType: "fixed" | "float",
Expand Down Expand Up @@ -157,11 +141,6 @@ export class SwapPage extends AppPage {
return this.detailsSwapId.innerText();
}

async waitForProviderRates() {
await this.centralisedQuoteFilterButton.waitFor({ state: "visible" });
await this.decentralisedQuoteFilterButton.waitFor({ state: "visible" });
}

// TODO: pull this function out into a utility function so we can use it elsewhere
async verifyHistoricalSwapsHaveLoadedFully() {
await this.page.waitForFunction(async () => {
Expand Down
66 changes: 6 additions & 60 deletions apps/ledger-live-desktop/tests/specs/services/swap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import test from "../../fixtures/mockFixtures";
import { expect } from "@playwright/test";
import { SwapPage } from "../../page/swap.page";
import { DeviceAction } from "../../models/DeviceAction";
import { Drawer } from "../../page/drawer/drawer";
import { AccountsPage } from "../../page/accounts.page";
import { AccountPage } from "../../page/account.page";
import { Layout } from "../../component/layout.component";
import { Modal } from "../../component/modal.component";
import test from "../../fixtures/mockFixtures";
import { DeviceAction } from "../../models/DeviceAction";
import { AccountPage } from "../../page/account.page";
import { AccountsPage } from "../../page/accounts.page";
import { Drawer } from "../../page/drawer/drawer";
import { SwapPage } from "../../page/swap.page";
import {
getBitcoinToDogecoinRatesMock,
getBitcoinToEthereumRatesMock,
getEthereumToTetherRatesMock,
getProvidersCDNDataMock,
} from "./services-api-mocks/getRates.mock";

Expand Down Expand Up @@ -97,7 +96,6 @@ test.describe.parallel("Swap", () => {
await swapPage.selectCurrencyFromCurrencyDropdown("Dogecoin");
await swapPage.sendMax(); // entering amount in textbox doesn't generate a quote in mock/PW
await layout.waitForLoadingSpinnerToHaveDisappeared();
await swapPage.waitForProviderRates();
await expect.soft(page).toHaveScreenshot("add-to-account-button.png");

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

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu)

[mocked_tests] › specs/services/swap.spec.ts:30:7 › Swap › Add accounts via Swap page @smoke

1) [mocked_tests] › specs/services/swap.spec.ts:30:7 › Swap › Add accounts via Swap page @smoke › Add account button appears for missing Destination (To) account Error: Screenshot comparison failed: 15273 pixels (ratio 0.02 of all image pixels) are different. Expected: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/services/swap.spec.ts-snapshots/add-to-account-button-linux.png Received: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/services-swap-Swap-Add-accounts-via-Swap-page-smoke-mocked-tests/add-to-account-button-actual.png Diff: /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/artifacts/test-results/services-swap-Swap-Add-accounts-via-Swap-page-smoke-mocked-tests/add-to-account-button-diff.png Call log: - expect.soft.toHaveScreenshot(add-to-account-button.png) with timeout 41000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 13965 pixels (ratio 0.02 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 - 13253 pixels (ratio 0.02 of all image pixels) are different. - waiting 250ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 15273 pixels (ratio 0.02 of all image pixels) are different. 97 | await swapPage.sendMax(); // entering amount in textbox doesn't generate a quote in mock/PW 98 | await layout.waitForLoadingSpinnerToHaveDisappeared(); > 99 | await expect.soft(page).toHaveScreenshot("add-to-account-button.png"); | ^ 100 | }); 101 | 102 | await test.step("Add account from missing Destination (To) account", async () => { at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/services/swap.spec.ts:99:31 at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/services/swap.spec.ts:94:5
});

Expand All @@ -107,58 +105,6 @@ test.describe.parallel("Swap", () => {
});
});

test("Filter Rates @smoke", async ({ page, mockProviderSvgs, mockFeesEndpoint }) => {
const swapPage = new SwapPage(page);
const layout = new Layout(page);

await page.route("https://swap.ledger.com/v5/rate**", async route => {
const mockRatesResponse = getEthereumToTetherRatesMock();
await route.fulfill({ headers: { teststatus: "mocked" }, body: mockRatesResponse });
});

await page.route("https://cdn.live.ledger.com/swap-providers/data.json", async route => {
const mockProvidersResponse = getProvidersCDNDataMock();
await route.fulfill({ headers: { teststatus: "mocked" }, body: mockProvidersResponse });
});

await test.step("Generate ETH to USDT quotes", async () => {
await swapPage.navigate();
await swapPage.reverseSwapPair();
await swapPage.filterDestinationCurrencyDropdown("Tether USD");
await layout.waitForLoadingSpinnerToHaveDisappeared();
await swapPage.selectCurrencyFromCurrencyDropdown("Tether USD");
await swapPage.sendMax();
await layout.waitForLoadingSpinnerToHaveDisappeared();
await swapPage.waitForProviderRates();
await expect.soft(page).toHaveScreenshot("eth-to-usdt-quotes-generated.png");
});

await test.step("Decentralised Quotes filtered", async () => {
await swapPage.filterByDecentralisedQuotes();
await expect.soft(page).toHaveScreenshot("only-decentralised-quotes-displayed.png");
});

await test.step("Fixed Decentralised Quotes filtered", async () => {
await swapPage.filterByFixedRateQuotes();
await expect.soft(page).toHaveScreenshot("fixed-decentralised-quotes-displayed.png");
});

await test.step("Floating Decentralised Quotes filtered", async () => {
await swapPage.filterByFloatingRateQuotes();
await expect.soft(page).toHaveScreenshot("floating-decentralised-quotes-displayed.png");
});

await test.step("Floating Centralised Quotes filtered", async () => {
await swapPage.filterByCentralisedQuotes();
await expect.soft(page).toHaveScreenshot("floating-centralised-quotes-displayed.png");
});

await test.step("Fixed Centralised filtered", async () => {
await swapPage.filterByFixedRateQuotes();
await expect.soft(page).toHaveScreenshot("fixed-centralised-quotes-diplayed.png");
});
});

test("Full Swap with Centralised Exchange @smoke", async ({
page,
mockProviderSvgs,
Expand Down

0 comments on commit 1a3759b

Please sign in to comment.