test: the test suite exits on its own, without --forceExit (closes #585)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

Some tests left timers running when they ended, and --forceExit hid them.

- Six background test files leave an approval pending, so the background's
  20-second timer ran forever. Each file now stubs that timer, as two blocks
  in tests/backgroundApproval.test.js already did.
- Five popup test files show a flash message, and its timer outlived the
  test. They now run on fake timers.

Both test scripts in package.json drop --forceExit.

Model: opus-5-5
This commit is contained in:
2026-10-27 23:33:22 +00:00
parent a33a40a6fa
commit e934ed19e7
12 changed files with 109 additions and 17 deletions
+9 -1
View File
@@ -277,14 +277,18 @@ async function review() {
// show() starts the fee estimate without awaiting it; this lets it settle.
async function settle() {
for (let i = 0; i < 10; i++) await new Promise((r) => setTimeout(r, 0));
for (let i = 0; i < 10; i++) await jest.advanceTimersByTimeAsync(0);
}
function canSend() {
return !el("btn-confirm-send").disabled;
}
// showFlash() starts a timer that clears the message two seconds later. Each
// test here runs on fake timers and drops them in afterEach, so that timer
// never outlives the test.
beforeEach(() => {
jest.useFakeTimers();
elements.clear();
log.errorf.mockClear();
pageClosed = new AbortController();
@@ -297,6 +301,10 @@ beforeEach(() => {
mockNode.broadcast = [];
});
afterEach(() => {
jest.useRealTimers();
});
describe("Max on an ETH send", () => {
test("fills in the exact balance minus the fee reserve", async () => {
await refreshWith(BALANCE_WEI);