test: drive WaitTx's timeout and failed-lookup exits end to end (closes #315)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

Two Chrome end-to-end cases send ETH and leave the wait for its receipt
running. In one, lookups answer "no receipt" until the 60-second deadline
ends the wait with the timeout message. In the other, a new fixture switch
makes every receipt lookup fail, and the sixth failure in a row ends the
wait with the message naming the unreachable network. Both check the exact
message and that Done returns to the address screen. Both wait in real
time: Playwright's clock would apply to every later test, and backdating
the stored broadcast time races the popup's own save.

Model: opus-5-5
This commit was merged in pull request #465.
This commit is contained in:
2026-10-05 14:26:06 +02:00
parent 9bd607b411
commit 9776f62f28
4 changed files with 111 additions and 1 deletions
+80
View File
@@ -2799,6 +2799,84 @@ test("a token that lies about decimals() at signing time broadcasts nothing (#30
}
});
// ------------------------------ the wait for a receipt ending in error (#315)
//
// README.md (WaitTx) documents two ways the wait ends on the error screen: a
// lookup that answers "no receipt" 60 seconds or more after the broadcast, and
// six lookups in a row that fail. They are different facts with different
// messages, so each is driven to its own.
//
// Both wait in real time, about a minute each. The wait reads the popup's own
// clock and its own ten-second timer. Playwright's clock would move both, but
// it is installed on the whole browser context and cannot be removed, so every
// later test would run on it. Moving the stored broadcast time back instead can
// be undone by the save the popup makes every ten seconds.
// Send ETH from the address screen and stop on the wait for its receipt.
async function sendEthToWait(env) {
await goToConfirm(env.page, {
token: "ETH",
balance: FUNDED_ETH_TEXT + " ETH",
amount: COMFORTABLE_AMOUNT,
});
await waitForEstimate(env.page);
await fillPasswordAndSend(env.page);
await visible(env.page, "#view-wait-tx", 60000);
}
test("a wait still without a receipt after 60 seconds ends on the timeout message (#315)", async (env) => {
try {
await sendEthToWait(env);
// Lookups run every ten seconds and answer "no receipt", so the one
// that ends the wait comes about 60 seconds after the broadcast.
await visible(env.page, "#view-error-tx", 90000);
const message = (
await env.page.locator("#error-tx-message").innerText()
).trim();
assert(
message ===
"Transaction was not confirmed within 60 seconds. It may still confirm later — check Etherscan.",
"the wait did not end on the timeout message: " +
JSON.stringify(message),
);
await env.page.click("#btn-error-tx-done");
await visible(env.page, "#view-address");
} finally {
await backToAddressAfterSend(env);
}
});
test("six failed receipt lookups in a row end on the unreachable-network message (#315)", async (env) => {
// Each failed lookup is logged through log.errorf, i.e. console.error.
// Exactly six are declared: a wait that ended sooner leaves one unmatched,
// and one that went on logs a seventh, and either fails this test.
for (let i = 1; i <= 6; i++) {
env.errors.expect(
"failed receipt lookup " + i + " of 6",
/poll receipt failed/,
);
}
env.routeOpts.failReceiptLookup = true;
try {
await sendEthToWait(env);
await visible(env.page, "#view-error-tx", 90000);
const message = (
await env.page.locator("#error-tx-message").innerText()
).trim();
assert(
message ===
"The network could not be reached to check this transaction — 6 lookups failed in a row. Check the RPC URL in Settings. The transaction may still have confirmed — check Etherscan.",
"the wait did not end on the unreachable-network message: " +
JSON.stringify(message),
);
await env.page.click("#btn-error-tx-done");
await visible(env.page, "#view-address");
} finally {
env.routeOpts.failReceiptLookup = false;
await backToAddressAfterSend(env);
}
});
// ------------------------------------------- hostile token symbol (#307)
//
// The reproduction from the issue, in the real browser against the real
@@ -4402,6 +4480,8 @@ async function main() {
// Whether eth_getTransactionReceipt confirms a transaction rather than
// answering "not mined yet".
seedReceipt: false,
// Whether eth_getTransactionReceipt fails instead of answering (#315).
failReceiptLookup: false,
// Every raw signed transaction handed to eth_sendRawTransaction, in
// order. The dApp transaction round trip asserts against these bytes
// rather than against anything the extension reported about them.