Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Use evaluateOnNewDocument for QA hooks

Abi Raja4dc585cb0adf
diff --git a/frontend/src/tests/qa.test.ts b/frontend/src/tests/qa.test.ts
index 295e0377..7ff5d3a7 100644
--- a/frontend/src/tests/qa.test.ts
+++ b/frontend/src/tests/qa.test.ts
@@ -376,7 +376,7 @@ async function setupRequestInterception(
}
async function installDomTestHooks(page: Page) {
- await page.addInitScript(() => {
+ await page.evaluateOnNewDocument(() => {
window.__qaDownloads = [];
window.__qaFormSubmits = [];
window.__qaClipboardCalls = [];
@@ -405,7 +405,7 @@ async function installDomTestHooks(page: Page) {
}
async function installMockWebSocket(page: Page) {
- await page.addInitScript(() => {
+ await page.evaluateOnNewDocument(() => {
class MockWebSocket {
static CONNECTING = 0;
static OPEN = 1;