From cbd52ae75580dbb6b71a4943c2858727d69e313c Mon Sep 17 00:00:00 2001 From: Fara Woolf Date: Thu, 27 Jun 2024 15:45:29 -0500 Subject: [PATCH] fix: add ledger test for bitcoin api calls, close @leather-io/issues#114 and #5574 --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- tests/specs/ledger/ledger.spec.ts | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a0523abf245..1ff431ec189 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "@leather.io/constants": "0.8.0", "@leather.io/crypto": "1.0.2", "@leather.io/models": "0.10.0", - "@leather.io/query": "0.9.2", + "@leather.io/query": "0.9.3", "@leather.io/tokens": "0.6.0", "@leather.io/ui": "1.5.1", "@leather.io/utils": "0.9.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cbcabae9753..4d031e8c254 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -48,8 +48,8 @@ importers: specifier: 0.10.0 version: 0.10.0 '@leather.io/query': - specifier: 0.9.2 - version: 0.9.2(@stacks/network@6.13.0(encoding@0.1.13))(encoding@0.1.13)(react@18.3.1) + specifier: 0.9.3 + version: 0.9.3(@stacks/network@6.13.0(encoding@0.1.13))(encoding@0.1.13)(react@18.3.1) '@leather.io/tokens': specifier: 0.6.0 version: 0.6.0 @@ -2901,8 +2901,8 @@ packages: '@leather.io/prettier-config@0.5.0': resolution: {integrity: sha512-Pul+4MAyBKnQvqgcKJLbZl4DHnS4kCJzSuaYFW6cfHdre7BFn/iY6Er/Dvm9F8g7VMtkdYu68jEYxQ1Xc7A0KQ==} - '@leather.io/query@0.9.2': - resolution: {integrity: sha512-PSrLRl89rOU/LL2mXT6RI5SVytWDDQx2XDthDD6d/McwBhz2NNhRTBnKjnTTlEA1/gaHGqL+VZrOWr86HZ9Wzg==} + '@leather.io/query@0.9.3': + resolution: {integrity: sha512-hGAcA4Au/lg2yz/bD006XHNieQ/FMCzFU6r8L+o7oipjG+lzR48r8enLNE/M1SgusgKXhcp577XXGBLNO7oB9w==} peerDependencies: react: '*' @@ -17583,7 +17583,7 @@ snapshots: - '@vue/compiler-sfc' - supports-color - '@leather.io/query@0.9.2(@stacks/network@6.13.0(encoding@0.1.13))(encoding@0.1.13)(react@18.3.1)': + '@leather.io/query@0.9.3(@stacks/network@6.13.0(encoding@0.1.13))(encoding@0.1.13)(react@18.3.1)': dependencies: '@fungible-systems/zone-file': 2.0.0 '@hirosystems/token-metadata-api-client': 1.2.0(encoding@0.1.13) diff --git a/tests/specs/ledger/ledger.spec.ts b/tests/specs/ledger/ledger.spec.ts index 2425516714c..b3ad04bd0f8 100644 --- a/tests/specs/ledger/ledger.spec.ts +++ b/tests/specs/ledger/ledger.spec.ts @@ -1,5 +1,7 @@ import { TEST_ACCOUNT_1_STX_ADDRESS } from '@tests/mocks/constants'; +import type { HomePage } from '@tests/page-object-models/home.page'; import { makeLedgerTestAccountWalletState } from '@tests/page-object-models/onboarding.page'; +import { SettingsSelectors } from '@tests/selectors/settings.selectors'; import { test } from '../../fixtures/fixtures'; @@ -9,6 +11,13 @@ const specs = { withBitcoinKeysOnly: makeLedgerTestAccountWalletState(['bitcoin']), }; +async function interceptBitcoinRequests(homePage: HomePage) { + const requestPromise = homePage.page.waitForRequest(/bestinslot|blockstream|inscriptions/, { + timeout: 1000, + }); + return requestPromise; +} + test.describe('App with Ledger', () => { for (const [testName, state] of Object.entries(specs)) { test.describe(testName, () => { @@ -33,6 +42,17 @@ test.describe('App with Ledger', () => { const stacksAddress = await homePage.getReceiveStxAddress(); test.expect(stacksAddress).toEqual(TEST_ACCOUNT_1_STX_ADDRESS); }); + + test('there are no bitcoin requests', async ({ homePage }) => { + const requestPromise = interceptBitcoinRequests(homePage); + + await homePage.page.getByTestId(SettingsSelectors.CurrentAccountDisplayName).click(); + + await test + .expect(async () => await test.expect(requestPromise).rejects.toThrowError()) + .toPass() + .catch(); + }); } test('that you can navigate to activity page', async ({ homePage }) => {