Skip to content
This repository was archived by the owner on Sep 3, 2026. It is now read-only.

Commit bbaaf89

Browse files
author
Pavel Lesyuk
committed
test(demo-wallet e2e): scrub internal QA refs from public code; wrap inline ui-test steps
- Remove internal test-plan section numbers, tracker IDs and TestOps project numbers from e2e comments and test/describe names (this is a public repo); keep behavior descriptions and repo-relative source code-refs. - Wrap the inline import/create-wallet ui-test flows in named allure.step so the Allure/TestOps execution reads as logical steps, on par with the page objects.
1 parent e0f07ee commit bbaaf89

8 files changed

Lines changed: 133 additions & 93 deletions

File tree

‎apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ export class DemoWallet extends WalletApp {
118118
* to sign an internal message without broadcasting it). The redesigned wallet renders
119119
* this as a per-type "Sign message for {dApp}" modal (`sign-message-request`; actions
120120
* `sign-message-approve` / `sign-message-reject`). Parity with the appkit-minter's
121-
* `DemoWallet.signMessage` — the two page-objects are kept split on purpose (see
122-
* TON-1682 D2; if kit moves to its own repo the object can't be shared).
121+
* `DemoWallet.signMessage` — the two page-objects are kept split on purpose (if kit
122+
* moves to its own repo the object can't be shared).
123123
*/
124124
async signMessage(confirm: boolean = true): Promise<void> {
125125
await step(confirm ? 'Approve & sign message' : 'Reject sign-message request', async () => {
@@ -144,7 +144,7 @@ export class DemoWallet extends WalletApp {
144144
* - the title `<h2 data-testid="request">` static verb (e.g. "Connect to"),
145145
* - a distinctive disclaimer/subtitle/section substring,
146146
* - the per-type approve & reject buttons by testid.
147-
* Strings traced to apps/demo-wallet/src/features/ton-connect/components/* (see TON-1701).
147+
* Strings traced to apps/demo-wallet/src/features/ton-connect/components/*.
148148
*/
149149
async expectConnectModal(): Promise<void> {
150150
await step('Assert connect-request modal', async () => {
@@ -301,7 +301,7 @@ export class DemoWallet extends WalletApp {
301301
* user pasting from the OS clipboard anywhere on the page (not into a specific field). The
302302
* wallet's global `usePasteHandler` listens on `document` and auto-routes TON Connect URLs
303303
* (tc:// / ton:// / http(s)://) to `handleTonConnectUrl` (use-paste-handler.ts). Used by the
304-
* §18.2 / §18.4 paste-routing checks.
304+
* global paste-routing checks.
305305
*/
306306
async pasteIntoDocument(text: string): Promise<void> {
307307
await step('Paste text into the wallet page (global clipboard paste)', async () => {

‎apps/demo-wallet/e2e/mock-dapp-tests/guards.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import { mockDappFixture } from '../ton-connect/mockDappFixture';
1010

1111
/**
12-
* Mock-first two-tab TON Connect — modal dismissibility guards (test-plan §18.1).
12+
* Mock-first two-tab TON Connect — modal dismissibility guards.
1313
*
14-
* Two invariants of the redesigned wallet (TON-1682):
14+
* Two invariants of the redesigned wallet:
1515
* - The TON Connect REQUEST modals (`connect-request` / `transaction-request` /
1616
* `sign-message-request` / `sign-data-request`) are NON-dismissible: backdrop click / Esc must
1717
* NOT close them — only Approve/Reject. They render via the shared DappRequestModal with

‎apps/demo-wallet/e2e/mock-dapp-tests/paste-routing.spec.ts‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,25 @@ import { expect } from '@playwright/test';
1111
import { mockDappFixture } from '../ton-connect/mockDappFixture';
1212

1313
/**
14-
* Mock-first two-tab TON Connect — global clipboard paste routing (test-plan §18.2 + §18.4).
14+
* Mock-first two-tab TON Connect — global clipboard paste routing.
1515
*
1616
* The wallet's global `usePasteHandler` (use-paste-handler.ts) listens on `document` and, when a
1717
* pasted string starts with `tc://` / `ton://` / `http(s)://`, routes it to `handleTonConnectUrl`
1818
* (which raises the connect-request modal). It is wired with `isDisabled = isConnectOpen`
1919
* (dashboard-header.tsx), so it is SUPPRESSED while the Connect-to-dApp paste modal is open — to
2020
* avoid double-handling alongside that modal's own textarea.
2121
*
22-
* - §18.2: a real `tc://` connect link pasted globally auto-routes → connect-request modal appears;
22+
* - A real `tc://` connect link pasted globally auto-routes → connect-request modal appears;
2323
* and with the paste modal open, the same global paste is suppressed (no connect-request modal).
24-
* - §18.4: non-TON garbage text pasted globally is ignored (no connect-request modal).
24+
* - Non-TON garbage text pasted globally is ignored (no connect-request modal).
2525
*
2626
* Paste is simulated by dispatching a synthetic `ClipboardEvent('paste')` on `document` carrying the
2727
* text in a `DataTransfer` — exactly the shape `usePasteHandler` reads (`clipboardData.getData`).
2828
*/
2929
const test = mockDappFixture();
3030

3131
test.describe('TON Connect mock-dApp — global paste routing (two-tab)', () => {
32-
test('§18.2 A real tc:// link pasted globally auto-routes to the connect-request modal', async ({
33-
wallet,
34-
dapp,
35-
}) => {
32+
test('A real tc:// link pasted globally auto-routes to the connect-request modal', async ({ wallet, dapp }) => {
3633
const url = await dapp.connectUrl();
3734
expect(url.startsWith('tc://')).toBe(true);
3835

@@ -46,7 +43,7 @@ test.describe('TON Connect mock-dApp — global paste routing (two-tab)', () =>
4643
await wallet.connect(false);
4744
});
4845

49-
test('§18.2 Global paste is suppressed while the Connect-to-dApp paste modal is open', async ({ wallet }) => {
46+
test('Global paste is suppressed while the Connect-to-dApp paste modal is open', async ({ wallet }) => {
5047
// Open the paste modal — this sets isConnectOpen=true → the global paste handler unsubscribes.
5148
await wallet.openPasteModal();
5249

@@ -56,7 +53,7 @@ test.describe('TON Connect mock-dApp — global paste routing (two-tab)', () =>
5653
await wallet.expectNoRequestModal(['connect-request']);
5754
});
5855

59-
test('§18.4 Non-TON clipboard text pasted globally is ignored', async ({ wallet }) => {
56+
test('Non-TON clipboard text pasted globally is ignored', async ({ wallet }) => {
6057
// Random garbage that matches none of the tc:// / ton:// / http(s):// prefixes.
6158
await wallet.pasteIntoDocument('just some random clipboard noise — not a TON Connect link');
6259
await wallet.expectNoRequestModal(['connect-request']);

‎apps/demo-wallet/e2e/mock-dapp-tests/queue.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { expect } from '@playwright/test';
1111
import { mockDappFixture } from '../ton-connect/mockDappFixture';
1212

1313
/**
14-
* Mock-first two-tab TON Connect — request queue (test-plan §18.3).
14+
* Mock-first two-tab TON Connect — request queue.
1515
*
1616
* The wallet processes TON Connect requests ONE AT A TIME via its request queue
1717
* (`tonConnectSlice.ts`: `enqueueRequest` → `processNextRequest`, gated on `isProcessing`; the next
@@ -31,7 +31,7 @@ import { mockDappFixture } from '../ton-connect/mockDappFixture';
3131
* The bridge does not guarantee which of the two requests is delivered first, so the assertions are
3232
* order-agnostic: exactly one of {sign-data-request, sign-message-request} is shown at a time.
3333
*
34-
* SCOPE NOTE — what this asserts vs. what it does NOT. The 18.3 invariant under test is the WALLET'S
34+
* SCOPE NOTE — what this asserts vs. what it does NOT. The invariant under test is the WALLET'S
3535
* queue: one request modal at a time, the second shown only after the first is resolved. That is
3636
* fully proven below (one modal → first settles on the dApp → second modal appears → resolved). It
3737
* is verified empirically that only the FIRST request's response round-trips back to the dApp

‎apps/demo-wallet/e2e/ui-tests/formatting.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ import { mockWalletApi, USDT_MASTER_RAW } from '../mocks/walletApi';
1616
const test = testWithUIFixture();
1717

1818
/**
19-
* §13 amount formatting through the Assets list, where the native GRAM row and jetton rows
19+
* Amount formatting through the Assets list, where the native GRAM row and jetton rows
2020
* render `formatLargeValue(amount, 4)`. `formatLargeValue` abbreviates ≥1M to M/B/T using the
2121
* integer-digit count, ALWAYS prints 2 fractional digits in that branch (the `decimals` arg is
2222
* ignored — silent precision drop ≥1M) and floors rather than rounds.
2323
*/
24-
test.describe('Amount formatting on the Assets list (§13)', () => {
24+
test.describe('Amount formatting on the Assets list', () => {
2525
test('Abbreviates a ≥1M GRAM balance to "M" with 2 digits, floored', async ({ webOnly: _webOnly, page }) => {
2626
// 1,234,567.899... GRAM (raw nanotons) → "1.23M" (floor to .23, never .24; only 2 digits even
2727
// though the row asks for 4). This is the precision-drop + floor behaviour in one assertion.

‎apps/demo-wallet/e2e/ui-tests/importWallet.spec.ts‎

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import { expect } from '@playwright/test';
1010
import type { Page } from '@playwright/test';
1111
import type { NetworkType } from '@demo/wallet-core';
12+
import { step } from 'allure-js-commons';
1213

1314
import { testWithUIFixture } from './UITestFixture';
1415
import { TEST_PASSWORD } from '../constants';
@@ -42,12 +43,14 @@ const testMatrix: ImportWalletTestCase[] = [
4243

4344
/** Welcome → "Add an existing wallet" → "Recovery phrase" → set a password → land on the import screen. */
4445
async function openImportScreen(page: Page): Promise<void> {
45-
await page.getByTestId('welcome-add-existing').click();
46-
await page.getByTestId('add-wallet-import').click();
47-
await page.getByTestId('password').fill(TEST_PASSWORD);
48-
await page.getByTestId('password-confirm').fill(TEST_PASSWORD);
49-
await page.getByTestId('password-submit').click();
50-
await page.getByTestId('paste-mnemonic').waitFor({ state: 'visible' });
46+
await step('Open the import screen', async () => {
47+
await page.getByTestId('welcome-add-existing').click();
48+
await page.getByTestId('add-wallet-import').click();
49+
await page.getByTestId('password').fill(TEST_PASSWORD);
50+
await page.getByTestId('password-confirm').fill(TEST_PASSWORD);
51+
await page.getByTestId('password-submit').click();
52+
await page.getByTestId('paste-mnemonic').waitFor({ state: 'visible' });
53+
});
5154
}
5255

5356
test.describe('Import Wallet Flow', () => {
@@ -62,25 +65,32 @@ test.describe('Import Wallet Flow', () => {
6265
const testName = `Import wallet - ${testCase.network} / ${testCase.version} / ${testCase.interfaceType}`;
6366

6467
test(testName, async ({ page }) => {
65-
await page.getByTestId(`network-select-${testCase.network}`).click();
66-
await expect(page.getByTestId(`network-select-${testCase.network}`)).toBeEnabled();
67-
68-
await page.getByTestId(`version-select-${testCase.version}`).click();
69-
await expect(page.getByTestId(`version-select-${testCase.version}`)).toBeEnabled();
70-
71-
await page.getByTestId(`interface-select-${testCase.interfaceType}`).click();
72-
await expect(page.getByTestId(`interface-select-${testCase.interfaceType}`)).toBeEnabled();
73-
74-
// Paste the recovery phrase via the Paste button (reads the clipboard).
75-
await page.evaluate(async (mnemonic) => {
76-
await navigator.clipboard.writeText(mnemonic);
77-
}, TEST_MNEMONIC);
78-
await page.getByTestId('paste-mnemonic').click();
79-
80-
await page.getByTestId('import-wallet-process').click();
81-
82-
// The settings button only exists on the wallet dashboard.
83-
await expect(page.getByTestId('wallet-menu')).toBeVisible();
68+
await step(
69+
`Select network/version/interface (${testCase.network} / ${testCase.version} / ${testCase.interfaceType})`,
70+
async () => {
71+
await page.getByTestId(`network-select-${testCase.network}`).click();
72+
await expect(page.getByTestId(`network-select-${testCase.network}`)).toBeEnabled();
73+
74+
await page.getByTestId(`version-select-${testCase.version}`).click();
75+
await expect(page.getByTestId(`version-select-${testCase.version}`)).toBeEnabled();
76+
77+
await page.getByTestId(`interface-select-${testCase.interfaceType}`).click();
78+
await expect(page.getByTestId(`interface-select-${testCase.interfaceType}`)).toBeEnabled();
79+
},
80+
);
81+
82+
await step('Paste recovery phrase & import', async () => {
83+
// Paste the recovery phrase via the Paste button (reads the clipboard).
84+
await page.evaluate(async (mnemonic) => {
85+
await navigator.clipboard.writeText(mnemonic);
86+
}, TEST_MNEMONIC);
87+
await page.getByTestId('paste-mnemonic').click();
88+
89+
await page.getByTestId('import-wallet-process').click();
90+
91+
// The settings button only exists on the wallet dashboard.
92+
await expect(page.getByTestId('wallet-menu')).toBeVisible();
93+
});
8494
});
8595
}
8696
});
@@ -91,33 +101,45 @@ test.describe('Import Wallet - Validation', () => {
91101
});
92102

93103
test('Import button is disabled with no mnemonic', async ({ page }) => {
94-
await expect(page.getByTestId('import-wallet-process')).toBeDisabled();
104+
await step('Verify the import button is disabled', async () => {
105+
await expect(page.getByTestId('import-wallet-process')).toBeDisabled();
106+
});
95107
});
96108

97109
test('Import button is disabled with less than 12 words', async ({ page }) => {
98-
const testWords = 'word1 word2 word3 word4 word5 word6 word7 word8 word9 word10';
99-
await page.evaluate(async (mnemonic) => {
100-
await navigator.clipboard.writeText(mnemonic);
101-
}, testWords);
110+
await step('Paste a recovery phrase with too few words', async () => {
111+
const testWords = 'word1 word2 word3 word4 word5 word6 word7 word8 word9 word10';
112+
await page.evaluate(async (mnemonic) => {
113+
await navigator.clipboard.writeText(mnemonic);
114+
}, testWords);
102115

103-
await page.getByTestId('paste-mnemonic').click();
116+
await page.getByTestId('paste-mnemonic').click();
117+
});
104118

105-
await expect(page.getByTestId('import-wallet-process')).toBeDisabled();
119+
await step('Verify the import button is disabled', async () => {
120+
await expect(page.getByTestId('import-wallet-process')).toBeDisabled();
121+
});
106122
});
107123

108124
test('Clear button clears all words', async ({ page }) => {
109125
if (!TEST_MNEMONIC) {
110126
test.skip(true, 'WALLET_MNEMONIC environment variable is required');
111127
}
112128

113-
await page.evaluate(async (mnemonic) => {
114-
await navigator.clipboard.writeText(mnemonic);
115-
}, TEST_MNEMONIC);
116-
await page.getByTestId('paste-mnemonic').click();
129+
await step('Paste the recovery phrase', async () => {
130+
await page.evaluate(async (mnemonic) => {
131+
await navigator.clipboard.writeText(mnemonic);
132+
}, TEST_MNEMONIC);
133+
await page.getByTestId('paste-mnemonic').click();
134+
});
117135

118-
await page.getByTestId('clear-mnemonic').click();
136+
await step('Clear the words', async () => {
137+
await page.getByTestId('clear-mnemonic').click();
138+
});
119139

120-
await expect(page.getByTestId('word-count')).toHaveText('0/24 words');
121-
await expect(page.getByTestId('import-wallet-process')).toBeDisabled();
140+
await step('Verify the word count resets and the import button is disabled', async () => {
141+
await expect(page.getByTestId('word-count')).toHaveText('0/24 words');
142+
await expect(page.getByTestId('import-wallet-process')).toBeDisabled();
143+
});
122144
});
123145
});

0 commit comments

Comments
 (0)