diff --git a/apps/ledger-live-desktop/tests/specs/general/stability.spec.ts b/apps/ledger-live-desktop/tests/specs/general/stability.spec.ts index 8f21ba1211e2..4cb85b3f746a 100644 --- a/apps/ledger-live-desktop/tests/specs/general/stability.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/general/stability.spec.ts @@ -5,7 +5,8 @@ import { AccountsPage } from "../../models/AccountsPage"; test.use({ userdata: "bot-accounts" }); -test("Stability of the app with numerous real accounts", async ({ page }) => { +// skipping as this as it's not valid for functional UI tests +test.skip("Stability of the app with numerous real accounts", async ({ page }) => { const layout = new Layout(page); const accountsPage = new AccountsPage(page); diff --git a/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts b/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts index 53c434305a32..2d7d2a4ec789 100644 --- a/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts +++ b/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts @@ -1,6 +1,7 @@ import test from "../../fixtures/common"; import { expect } from "@playwright/test"; import { Layout } from "../../models/Layout"; +import { LiveAppWebview } from "../../models/LiveAppWebview"; test.use({ userdata: "1AccountBTC1AccountETH", @@ -11,13 +12,45 @@ test.use({ }, }); -test("Add accounts via Swap page", async ({ page }) => { +let testServerIsRunning = false; + +test.beforeAll(async () => { + // Check that dummy app in libs/test-utils/dummy-ptx-app has been started successfully + testServerIsRunning = await LiveAppWebview.startLiveApp("dummy-ptx-app/public", { + name: "Earn", + id: "earn", + apiVersion: "^2.0.0", + permissions: [ + { + method: "account.list", + }, + ], + }); + + if (!testServerIsRunning) { + console.warn("Stopping Earn test setup"); + return; + } +}); + +test.afterAll(async () => { + await LiveAppWebview.stopLiveApp(); +}); + +test("Earn", async ({ page }) => { + // Don't run test if server is not running + if (!testServerIsRunning) return; + const layout = new Layout(page); + const liveAppWebview = new LiveAppWebview(page); - await test.step("Navigate to earn page", async () => { + await test.step("Navigate to Buy app from portfolio banner", async () => { await layout.goToEarn(); - await expect.soft(page).toHaveScreenshot("earn-app-opened.png", { - mask: [page.locator("data-test-id=earn-app-container")], - }); + await expect(await liveAppWebview.waitForCorrectTextInWebview("theme: dark")).toBe(true); + await expect(await liveAppWebview.waitForCorrectTextInWebview("lang: en")).toBe(true); + await expect(await liveAppWebview.waitForCorrectTextInWebview("currencyTicker: USD")).toBe( + true, + ); + await expect.soft(page).toHaveScreenshot("earn-app-opened.png"); }); }); diff --git a/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-darwin.png b/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-darwin.png index ece3d9b49019..4abfd84b0c23 100644 Binary files a/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-darwin.png and b/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-darwin.png differ diff --git a/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-linux.png b/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-linux.png index d4c7bc95eff8..ea92d55d29da 100644 Binary files a/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-linux.png and b/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-linux.png differ diff --git a/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-win32.png b/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-win32.png index 837b157ed9aa..6288b2dd2f8a 100644 Binary files a/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-win32.png and b/apps/ledger-live-desktop/tests/specs/services/earn.smoke.spec.ts-snapshots/earn-app-opened-smoke-win32.png differ diff --git a/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-darwin.png b/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-darwin.png deleted file mode 100644 index 98c5bd634db3..000000000000 Binary files a/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-darwin.png and /dev/null differ diff --git a/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-linux.png b/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-linux.png deleted file mode 100644 index f9d91d773d46..000000000000 Binary files a/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-linux.png and /dev/null differ diff --git a/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-win32.png b/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-win32.png deleted file mode 100644 index 345ff5ab5e77..000000000000 Binary files a/apps/ledger-live-desktop/tests/specs/services/earn.spec.ts-snapshots/earn-app-opened-win32.png and /dev/null differ diff --git a/apps/ledger-live-mobile/package.json b/apps/ledger-live-mobile/package.json index 44b8b522f54e..9aa4fb116a55 100644 --- a/apps/ledger-live-mobile/package.json +++ b/apps/ledger-live-mobile/package.json @@ -80,7 +80,6 @@ "@ledgerhq/react-native-hid": "workspace:^", "@ledgerhq/react-native-hw-transport-ble": "workspace:^", "@ledgerhq/react-native-passcode-auth": "^2.1.0", - "@ledgerhq/test-utils": "workspace:^", "@ledgerhq/types-cryptoassets": "workspace:^", "@ledgerhq/types-devices": "workspace:^", "@ledgerhq/types-live": "workspace:^", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d51c5c46bf0a..b13e50ea59f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -792,9 +792,6 @@ importers: '@ledgerhq/react-native-passcode-auth': specifier: ^2.1.0 version: 2.1.0 - '@ledgerhq/test-utils': - specifier: workspace:^ - version: link:../../libs/test-utils '@ledgerhq/types-cryptoassets': specifier: workspace:^ version: link:../../libs/ledgerjs/packages/types-cryptoassets @@ -1174,6 +1171,9 @@ importers: '@jest/reporters': specifier: ^29.3.1 version: 29.5.0(metro@0.76.0) + '@ledgerhq/test-utils': + specifier: workspace:^ + version: link:../../libs/test-utils '@react-native-community/cli': specifier: ^7.0.1 version: 7.0.4(@babel/core@7.22.8)(metro-resolver@0.76.0)(metro-transform-worker@0.76.0)(react-native@0.71.6)