test: drive WaitTx's timeout and failed-lookup exits end to end (closes #315)
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:
@@ -460,6 +460,16 @@ function rpcReply(req, opts, report) {
|
||||
return Object.assign(envelope, { result: ethCallResult(req, opts) });
|
||||
}
|
||||
if (req.method === "eth_getTransactionReceipt") {
|
||||
// A lookup that fails, which the wait screen counts differently from
|
||||
// one that answers "not mined yet" (README.md, WaitTx).
|
||||
if (opts.failReceiptLookup) {
|
||||
return Object.assign(envelope, {
|
||||
error: {
|
||||
code: -32000,
|
||||
message: "e2e fixture: receipt lookup failed",
|
||||
},
|
||||
});
|
||||
}
|
||||
const hash = Array.isArray(req.params) ? req.params[0] : null;
|
||||
return Object.assign(envelope, {
|
||||
result: opts.seedReceipt && hash ? transactionReceipt(hash) : null,
|
||||
@@ -619,6 +629,8 @@ function traceEnabled(raw) {
|
||||
* symbol is markup; read at request time.
|
||||
* @param {boolean} [opts.seedReceipt] answer eth_getTransactionReceipt with a
|
||||
* confirmed receipt instead of null, so a wait screen resolves.
|
||||
* @param {boolean} [opts.failReceiptLookup] answer eth_getTransactionReceipt
|
||||
* with an error, so every receipt lookup fails; read at request time.
|
||||
* @returns {Promise<{waitForServiceWorkerTraffic: (ms: number) =>
|
||||
* Promise<string|null>}>}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user