فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(A07): tolerate CDP context destruction during initial navigation and reload
davoodmehraban89 committed
Oct 15, 2026 at 20:58 UTC
bfe1357a03df7966bd2f8638ab186b14485bb929
1 file changed
+4
-2
tests/a07-windows-offline-browser-smoke.cjs
+4
-2
@@ -103,7 +103,9 @@ async function loadChromeCDP(wsURL) {
103
await cdp.command('Page.reload', { ignoreCache: true });
104
await sleep(900);
105
}
106
- const state = await cdp.evaluate(`(async () => {
106
+ // A reload can destroy the JS context while CDP evaluates it. Retry
107
+ // until the new document's real authentication screen is ready.
108
+ const state = await eventually(() => cdp.evaluate(`(async () => {
109
for (let j = 0; j < 180; j++) {
110
const hasAuth = !!document.getElementById('finoraAuthOverlay');
111
const loaded = !!window.FINORA;
@@ -119,7 +121,7 @@ async function loadChromeCDP(wsURL) {
121
await new Promise(resolve => setTimeout(resolve, 100));
122
}
123
throw Error('Authentication overlay never appeared; startup may be stalled');
122
- })()`);
124
+ })()`), 30000, 300);
125
assert.equal(state.hasAuth, true);
126
assert.equal(state.loaded, true);
127
assert.equal(state.errors, '');