test: no timer a popup test started fires after cleanupPopup() (closes #578)
tests/support/popupBoot.js recorded every interval the popup sets but left timeouts alone, so the two-second timer that clears a flash message could fire after cleanupPopup() had removed the page, throw "document is not defined", and fail whichever test file the jest worker had moved on to. Timeouts still run for real during a popup test; the helper now records each one until it fires or is cleared, and cleanupPopup() clears the ones still pending. The fake timers tests/firstWalletRefresh.test.js used to hold that timer are removed. tests/popupBoot.test.js shows a flash message, cleans up, waits past the flash duration, and fails if anything throws. Model: opus-5-5
This commit was merged in pull request #582.
This commit is contained in:
@@ -61,16 +61,12 @@ async function importOn(page, { tab, field, secret }) {
|
||||
await page.click("btn-add-wallet-confirm");
|
||||
}
|
||||
|
||||
// Fake timers hold the timer of the flash message an import ends with, which
|
||||
// would otherwise fire after cleanupPopup() has removed the page and throw.
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
chainBalance = "0.0";
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanupPopup();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
describe("a popup that opened on Welcome", () => {
|
||||
|
||||
Reference in New Issue
Block a user