test: a check run while the page reloads tries again instead of failing (CI run 397)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 8m25s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m13s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 8m25s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m13s
Page.reload returns before the old page is gone; a check sent in that gap got 'Inspected target navigated or closed'. waitFor retries only that kind of error; any other still fails the test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,13 @@ const pause=ms=>new Promise(r=>setTimeout(r,ms));
|
|||||||
let stderr='';chrome.stderr.on('data',data=>stderr+=data.toString());
|
let stderr='';chrome.stderr.on('data',data=>stderr+=data.toString());
|
||||||
const clients=[];
|
const clients=[];
|
||||||
let kanban,testMachine;
|
let kanban,testMachine;
|
||||||
async function waitFor(fn,description,timeout=30000){const end=Date.now()+timeout;while(Date.now()<end){if(await fn())return;await pause(200);}throw new Error('Timeout: '+description);}
|
// A check run while the page reloads meets the old page closing ("Inspected
|
||||||
|
// target navigated or closed", CI run 397): that one tries again; any other
|
||||||
|
// error still fails the test.
|
||||||
|
const navigating=error=>/navigated or closed|context was destroyed|Cannot find (default )?(execution )?context/i
|
||||||
|
.test(String(error?.message||error));
|
||||||
|
async function waitFor(fn,description,timeout=30000){const end=Date.now()+timeout;while(Date.now()<end){
|
||||||
|
try{if(await fn())return;}catch(error){if(!navigating(error))throw error;}await pause(200);}throw new Error('Timeout: '+description);}
|
||||||
class Page {
|
class Page {
|
||||||
constructor(ws){this.ws=ws;this.next=0;this.pending=new Map();this.errors=[];
|
constructor(ws){this.ws=ws;this.next=0;this.pending=new Map();this.errors=[];
|
||||||
ws.onmessage=event=>{const d=JSON.parse(event.data);if(d.id){const p=this.pending.get(d.id);if(p){this.pending.delete(d.id);d.error?p.reject(d.error):p.resolve(d.result);}}else if(d.method==='Runtime.exceptionThrown')this.errors.push(d.params.exceptionDetails);};
|
ws.onmessage=event=>{const d=JSON.parse(event.data);if(d.id){const p=this.pending.get(d.id);if(p){this.pending.delete(d.id);d.error?p.reject(d.error):p.resolve(d.result);}}else if(d.method==='Runtime.exceptionThrown')this.errors.push(d.params.exceptionDetails);};
|
||||||
|
|||||||
Reference in New Issue
Block a user