Skip to content

Commit

Permalink
fix: add ledger test for bitcoin api calls, close #114 and #5574
Browse files Browse the repository at this point in the history
  • Loading branch information
fbwoolf committed Jun 27, 2024
1 parent 65131b0 commit 00804b3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions tests/specs/ledger/ledger.spec.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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, () => {
Expand All @@ -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 }) => {
Expand Down

0 comments on commit 00804b3

Please sign in to comment.