Skip to content

Commit 4035f0d

Browse files
committed
Wait for the document before asserting the app loaded
The built-browser check evaluated its expression as soon as the navigation resolved and threw if #app was not already in the DOM. A CI runner reaches that point before the document has parsed, so the job failed there while passing locally. It now polls for the element.
1 parent b2dd04d commit 4035f0d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎scripts/security/check-built-browser.mjs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ function browserExpression(editorAsset, mermaidAsset) {
191191
.map((attribute) => attribute.name + '=' + attribute.value));
192192
};
193193
194+
// Poll rather than assert once: this evaluates as soon as the navigation
195+
// resolves, and a CI runner is slow enough to get here before the document
196+
// has parsed. Asserting immediately failed there while passing locally.
197+
for (let waited = 0; !document.querySelector('#app') && waited < 30000; waited += 100) {
198+
await sleep(100);
199+
}
194200
if (!document.querySelector('#app')) throw new Error('The built application did not load.');
195201
globalThis.__artifactSecurityExecuted = 0;
196202

0 commit comments

Comments
 (0)