test: assert the #150 and #151 items the harness did not cover (closes #188) #288

Open
clawbot wants to merge 1 commits from issue-188-dod-assertions into next
Collaborator

Closes #188.

The suite asserted that the two screens
#150 and
#151 broke now open without
throwing. The four remaining definition-of-done items are asserted here.
Additive: four tests and one fixture flag, no existing test or helper changed.

What is asserted

Back navigation out of Add Token. Against the persisted navigation stack,
read from extension storage, as a delta: the round trip Home -> AddressDetail
-> AddToken -> Back -> Back must leave the stack exactly as it found it, with
["main"] and then ["main","address"] on top at the two forward steps. A
stale entry is invisible on screen until the user presses Back one time too
many — the second-order damage of #150 — so the stack rather than the visible
view is what gets asserted. Stating it as a delta makes it independent of
whatever depth earlier tests leave behind.

The common-token quick-pick. Clicks the first button and requires
#add-token-address to hold that button's data-address; the field is
asserted empty first. The old test counted the buttons rendered.

The native ETH detail path. This needed a fixture: the Blockscout
normal-transactions endpoint answered {items: []} unconditionally, so there
was no non-ERC-20 row to open at all. seedNativeTransfer serves one 0.25 ETH
transfer (above the default dust threshold, its own hash so
mergeTransactions() does not fold it into the token transfer). The detail
screen must show the native hash, type Native ETH Transfer, the value, the
raw wei quantity, and no token contract row — that row's branch is where a
regression of the non-ERC-20 case lands. The flag is cleared again at the end
of the test, so every later test sees the list it was written against.

Tap-to-copy. Reads the real clipboard back rather than watching the handler
run, after seeding a sentinel so an untouched clipboard cannot pass. Clipboard
permissions are granted context-wide: an origin-scoped grant is refused for
chrome-extension: URLs (Permission can't be granted to opaque origins).

Nothing was weakened and no item was dropped. All four are driven from the
Chrome harness; the Firefox suite was not touched.

Each assertion demonstrated failing

One deliberate break at a time, full make test-e2e run, source reverted after
each. In every case the pre-existing tests 4 and 5 stayed green, so each
failure is attributable to the new assertion.

  1. Back stack — src/popup/index.js, showAddTokenView pushes twice:
ok 4 - add token screen opens from address detail (#150)
ok 5 - transaction detail renders an ERC-20 transfer (#151)
not ok 6 - Back from Add Token unwinds the stack exactly once (#150)
  navigation stack on the add token screen is ["main","address","address","main","address","address"], expected ["main","address","address","main","address"]

A screen-only assertion does not see this: the first Back still lands on the
address screen.

  1. Quick-pick — src/popup/views/addToken.js, the click handler made a no-op:
not ok 7 - a common-token quick-pick fills in the contract address (#150)
  clicking the WETH quick-pick left the address field as "", expected "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
  1. Native ETH, two breaks. The token-contract guard in
    src/popup/views/transactionDetail.js removed, i.e. the ERC-20 branch running
    for a transfer with no contract:
not ok 8 - the native ETH transaction detail still renders (#151)
  page.waitForSelector: Timeout 15000ms exceeded.
  Call log:
    - waiting for locator('#view-transaction') to be visible
      35 x locator resolved to hidden <div class="view hidden" id="view-transaction">...</div>

  pageerror: Cannot read properties of null (reading 'slice')

And the same row left visible without throwing, which is what isolates the
hidden-row assertion itself:

not ok 8 - the native ETH transaction detail still renders (#151)
  the token contract row is showing on a transfer that has no token contract
  1. Tap-to-copy — attachCopyHandlers() in src/popup/views/helpers.js keeps
    the flash and drops the writeText:
not ok 9 - tap-to-copy on the transaction detail screen copies the address (#151)
  tapping the token contract address put "e2e-clipboard-untouched" on the clipboard, expected 0xe2e0000000000000000000000000000000000e2e

The flash-only half of the assertion passes against this break; the clipboard
read is what catches it.

Verification

Ran, after rebasing onto next at 0be20d7 (which reworked goBack(), so the
whole suite was re-run rather than trusted):

  • make check — green. 703 tests in 29 suites, test-verify-build 18 cases,
    prettier --check clean twice (lint and fmt-check).
  • make test-e2e — green, 44/44, with the four new tests at 6-9.
  • make fmt — run, result committed.

Not run: make test-e2e-firefox. This change adds nothing to the Firefox
suite. script/lint here is prettier --check on the host, not containerized;
that is the repo's current entrypoint, and ESLint for it is
#152.

Closes https://git.eeqj.de/sneak/AutistMask/issues/188. The suite asserted that the two screens https://git.eeqj.de/sneak/AutistMask/issues/150 and https://git.eeqj.de/sneak/AutistMask/issues/151 broke now open without throwing. The four remaining definition-of-done items are asserted here. Additive: four tests and one fixture flag, no existing test or helper changed. ## What is asserted **Back navigation out of Add Token.** Against the persisted navigation stack, read from extension storage, as a delta: the round trip Home -&gt; AddressDetail -&gt; AddToken -&gt; Back -&gt; Back must leave the stack exactly as it found it, with `["main"]` and then `["main","address"]` on top at the two forward steps. A stale entry is invisible on screen until the user presses Back one time too many — the second-order damage of #150 — so the stack rather than the visible view is what gets asserted. Stating it as a delta makes it independent of whatever depth earlier tests leave behind. **The common-token quick-pick.** Clicks the first button and requires `#add-token-address` to hold that button's `data-address`; the field is asserted empty first. The old test counted the buttons rendered. **The native ETH detail path.** This needed a fixture: the Blockscout normal-transactions endpoint answered `{items: []}` unconditionally, so there was no non-ERC-20 row to open at all. `seedNativeTransfer` serves one 0.25 ETH transfer (above the default dust threshold, its own hash so `mergeTransactions()` does not fold it into the token transfer). The detail screen must show the native hash, type `Native ETH Transfer`, the value, the raw wei quantity, and no token contract row — that row's branch is where a regression of the non-ERC-20 case lands. The flag is cleared again at the end of the test, so every later test sees the list it was written against. **Tap-to-copy.** Reads the real clipboard back rather than watching the handler run, after seeding a sentinel so an untouched clipboard cannot pass. Clipboard permissions are granted context-wide: an origin-scoped grant is refused for `chrome-extension:` URLs (`Permission can't be granted to opaque origins`). Nothing was weakened and no item was dropped. All four are driven from the Chrome harness; the Firefox suite was not touched. ## Each assertion demonstrated failing One deliberate break at a time, full `make test-e2e` run, source reverted after each. In every case the pre-existing tests 4 and 5 stayed green, so each failure is attributable to the new assertion. 1. Back stack — `src/popup/index.js`, `showAddTokenView` pushes twice: ``` ok 4 - add token screen opens from address detail (#150) ok 5 - transaction detail renders an ERC-20 transfer (#151) not ok 6 - Back from Add Token unwinds the stack exactly once (#150) navigation stack on the add token screen is ["main","address","address","main","address","address"], expected ["main","address","address","main","address"] ``` A screen-only assertion does not see this: the first Back still lands on the address screen. 2. Quick-pick — `src/popup/views/addToken.js`, the click handler made a no-op: ``` not ok 7 - a common-token quick-pick fills in the contract address (#150) clicking the WETH quick-pick left the address field as "", expected "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" ``` 3. Native ETH, two breaks. The token-contract guard in `src/popup/views/transactionDetail.js` removed, i.e. the ERC-20 branch running for a transfer with no contract: ``` not ok 8 - the native ETH transaction detail still renders (#151) page.waitForSelector: Timeout 15000ms exceeded. Call log: - waiting for locator('#view-transaction') to be visible 35 x locator resolved to hidden <div class="view hidden" id="view-transaction">...</div> pageerror: Cannot read properties of null (reading 'slice') ``` And the same row left visible without throwing, which is what isolates the hidden-row assertion itself: ``` not ok 8 - the native ETH transaction detail still renders (#151) the token contract row is showing on a transfer that has no token contract ``` 4. Tap-to-copy — `attachCopyHandlers()` in `src/popup/views/helpers.js` keeps the flash and drops the `writeText`: ``` not ok 9 - tap-to-copy on the transaction detail screen copies the address (#151) tapping the token contract address put "e2e-clipboard-untouched" on the clipboard, expected 0xe2e0000000000000000000000000000000000e2e ``` The flash-only half of the assertion passes against this break; the clipboard read is what catches it. ## Verification Ran, after rebasing onto `next` at `0be20d7` (which reworked `goBack()`, so the whole suite was re-run rather than trusted): - `make check` — green. 703 tests in 29 suites, `test-verify-build` 18 cases, `prettier --check` clean twice (lint and fmt-check). - `make test-e2e` — green, 44/44, with the four new tests at 6-9. - `make fmt` — run, result committed. Not run: `make test-e2e-firefox`. This change adds nothing to the Firefox suite. `script/lint` here is `prettier --check` on the host, not containerized; that is the repo's current entrypoint, and ESLint for it is https://git.eeqj.de/sneak/AutistMask/issues/152.
clawbot added 1 commit 2026-08-14 06:24:06 +02:00
test: assert the #150 and #151 items the harness did not cover (closes #188)
All checks were successful
check / check (push) Successful in 33s
e53bcb655d
The suite asserted that the two screens those issues broke now open
without throwing, which is narrower than their definition of done. The
four remaining items are asserted here, additively; nothing existing was
restructured.

Back navigation out of Add Token is checked against the persisted
navigation stack, read from extension storage, as a delta: the round trip
Home -> AddressDetail -> AddToken -> Back -> Back must leave the stack
exactly as it found it. A stale entry is invisible on screen until the
user presses Back one time too many, which is precisely the second-order
damage of #150, so the stack rather than the visible view is what gets
asserted. Stating it as a delta keeps it independent of whatever depth
earlier tests leave behind.

The quick-pick test clicks a button and requires the address field to
hold that button's contract address; the old assertion only counted the
buttons rendered.

The native ETH detail path needed a fixture: the normal-transactions
endpoint answered with an empty list unconditionally, so there was no
non-ERC-20 row to open at all. seedNativeTransfer serves one, and the
detail screen must show the native type, the value, the raw wei quantity
and no token contract row - the row whose branch is where a regression of
the non-ERC-20 case would land.

Tap-to-copy reads the real clipboard back rather than watching the
handler run, after seeding a sentinel so an untouched clipboard cannot
pass. Clipboard permissions are granted context-wide because an
origin-scoped grant is refused for chrome-extension: URLs.

Each of the four was demonstrated failing against a deliberately broken
build; the captured output is in the pull request.
clawbot added the needs-review label 2026-08-14 06:24:11 +02:00
clawbot self-assigned this 2026-08-14 06:24:14 +02:00
All checks were successful
check / check (push) Successful in 33s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-188-dod-assertions:issue-188-dod-assertions
git checkout issue-188-dod-assertions
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#288