From 39b0812066dda9023a9540882021a1269913db97 Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 11:17:48 -0700 Subject: [PATCH 01/10] Debug windows e2e tests --- tests/e2e/puppeteer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/puppeteer.ts b/tests/e2e/puppeteer.ts index 2f39a2116..09052b9f9 100644 --- a/tests/e2e/puppeteer.ts +++ b/tests/e2e/puppeteer.ts @@ -52,7 +52,7 @@ export const connect = () => { }); const browserURL = `http://localhost:${electronDebugPort}` - const browser = output.browser = await puppeteer.launch({ headless: 'new', protocolTimeout: launchProtocolTimeout}) + const browser = output.browser = await puppeteer.launch({ headless: 'new', protocolTimeout: launchProtocolTimeout, dumpio: true}) const page = output.page = await browser.newPage(); await page.goto(browserURL); const endpoint = await page.evaluate(() => fetch(`json/version`).then(res => res.json()).then(res => res.webSocketDebuggerUrl)) From 0e8f6521320b42e2c96cf6323327f7fae55a21e6 Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 11:59:50 -0700 Subject: [PATCH 02/10] Test --- tests/e2e/tutorial.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/tutorial.test.ts b/tests/e2e/tutorial.test.ts index 67354b0d6..76f85d15c 100644 --- a/tests/e2e/tutorial.test.ts +++ b/tests/e2e/tutorial.test.ts @@ -54,7 +54,7 @@ describe('E2E Test', () => { const outputLocation = await evaluate(async () => { const dashboard = document.querySelector('nwb-dashboard') const page = dashboard.page - const outputLocation = await page.generateTestData() + const outputLocation = await page.waitForResponse(page.generateTestData()) page.requestUpdate() return outputLocation }) From f58da9c9e73e239d08f4c3ad1fe191283c1b2f74 Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 12:13:30 -0700 Subject: [PATCH 03/10] Try to debug test dataset generation --- tests/e2e/tutorial.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/tutorial.test.ts b/tests/e2e/tutorial.test.ts index 76f85d15c..4f4bca274 100644 --- a/tests/e2e/tutorial.test.ts +++ b/tests/e2e/tutorial.test.ts @@ -54,10 +54,10 @@ describe('E2E Test', () => { const outputLocation = await evaluate(async () => { const dashboard = document.querySelector('nwb-dashboard') const page = dashboard.page - const outputLocation = await page.waitForResponse(page.generateTestData()) + const outputLocation = await page.generateTestData() page.requestUpdate() return outputLocation - }) + }, { timeout: 6 * 10 * 1000 }) // Wait up to 6 minutes for dataset generation // Take image after dataset generation await takeScreenshot('dataset-created', 500, { clip: datasetScreenshotClip }) From 23bd9082fea8651182bc93e129b0826a8e66971a Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 13:05:18 -0700 Subject: [PATCH 04/10] Try another way --- tests/e2e/puppeteer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e/puppeteer.ts b/tests/e2e/puppeteer.ts index 09052b9f9..3fc1485e7 100644 --- a/tests/e2e/puppeteer.ts +++ b/tests/e2e/puppeteer.ts @@ -52,9 +52,10 @@ export const connect = () => { }); const browserURL = `http://localhost:${electronDebugPort}` - const browser = output.browser = await puppeteer.launch({ headless: 'new', protocolTimeout: launchProtocolTimeout, dumpio: true}) + const browser = output.browser = await puppeteer.launch({ headless: 'new', timeout: launchProtocolTimeout, protocolTimeout: launchProtocolTimeout, dumpio: true}) const page = output.page = await browser.newPage(); await page.goto(browserURL); + page.setDefaultTimeout(launchProtocolTimeout); const endpoint = await page.evaluate(() => fetch(`json/version`).then(res => res.json()).then(res => res.webSocketDebuggerUrl)) await browser.close() delete output.browser From e81a83c437c022a55f2bdbda35f8b08945570214 Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 13:21:29 -0700 Subject: [PATCH 05/10] Try another way --- tests/e2e/puppeteer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/puppeteer.ts b/tests/e2e/puppeteer.ts index 3fc1485e7..c9d01f050 100644 --- a/tests/e2e/puppeteer.ts +++ b/tests/e2e/puppeteer.ts @@ -55,7 +55,6 @@ export const connect = () => { const browser = output.browser = await puppeteer.launch({ headless: 'new', timeout: launchProtocolTimeout, protocolTimeout: launchProtocolTimeout, dumpio: true}) const page = output.page = await browser.newPage(); await page.goto(browserURL); - page.setDefaultTimeout(launchProtocolTimeout); const endpoint = await page.evaluate(() => fetch(`json/version`).then(res => res.json()).then(res => res.webSocketDebuggerUrl)) await browser.close() delete output.browser @@ -63,10 +62,11 @@ export const connect = () => { // Connect to browser WS Endpoint const browserWSEndpoint = endpoint.replace('localhost', '0.0.0.0') - output.browser = await puppeteer.connect({ browserWSEndpoint, defaultViewport: null }) + output.browser = await puppeteer.connect({ browserWSEndpoint, defaultViewport: null, protocolTimeout: launchProtocolTimeout}) const pages = await output.browser.pages() output.page = pages[0] + output.page.setDefaultTimeout(launchProtocolTimeout); }, beforeStartTimeout + 1000) From 7fd9363700e0044e9357b766435f36a3db4db71d Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 13:39:37 -0700 Subject: [PATCH 06/10] Getting closer. Try to narrow scope of timeout increase --- tests/e2e/tutorial.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/e2e/tutorial.test.ts b/tests/e2e/tutorial.test.ts index 4f4bca274..b1e70be5c 100644 --- a/tests/e2e/tutorial.test.ts +++ b/tests/e2e/tutorial.test.ts @@ -36,7 +36,8 @@ describe('E2E Test', () => { const datasetTestFunction = config.regenerateTestData ? test : test.skip - datasetTestFunction('Create tutorial dataset', async () => { + // Wait up to 10 minutes for dataset generation + datasetTestFunction('Create tutorial dataset', { timeout: 10 * 10 * 1000 }, async () => { await evaluate(async () => { @@ -57,7 +58,7 @@ describe('E2E Test', () => { const outputLocation = await page.generateTestData() page.requestUpdate() return outputLocation - }, { timeout: 6 * 10 * 1000 }) // Wait up to 6 minutes for dataset generation + }) // Take image after dataset generation await takeScreenshot('dataset-created', 500, { clip: datasetScreenshotClip }) From 16e74ca0a075126036690a62a6d1bd76ae47c803 Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 13:54:46 -0700 Subject: [PATCH 07/10] There are 60 seconds in a minute not 10 --- tests/e2e/tutorial.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/tutorial.test.ts b/tests/e2e/tutorial.test.ts index b1e70be5c..17634912e 100644 --- a/tests/e2e/tutorial.test.ts +++ b/tests/e2e/tutorial.test.ts @@ -37,7 +37,7 @@ describe('E2E Test', () => { const datasetTestFunction = config.regenerateTestData ? test : test.skip // Wait up to 10 minutes for dataset generation - datasetTestFunction('Create tutorial dataset', { timeout: 10 * 10 * 1000 }, async () => { + datasetTestFunction('Create tutorial dataset', { timeout: 10 * 60 * 1000 }, async () => { await evaluate(async () => { From 3439fe8e02f9ea77863929245e94677d14fdfbc1 Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 14:14:41 -0700 Subject: [PATCH 08/10] Increase timeout - 6 minutes is not enough --- tests/e2e/puppeteer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/puppeteer.ts b/tests/e2e/puppeteer.ts index c9d01f050..d0cb33a65 100644 --- a/tests/e2e/puppeteer.ts +++ b/tests/e2e/puppeteer.ts @@ -34,7 +34,7 @@ type BrowserTestOutput = { } const beforeStartTimeout = 60 * 1000 // Wait for 1 minute for Electron to open (mostly for Windows) -const launchProtocolTimeout = 6 * 60 * 1000 // Creating the test dataset can take up to 6 minutes (mostly for Windows) +const launchProtocolTimeout = 10 * 60 * 1000 // Creating the test dataset can take up to 10 minutes (mostly for Windows) export const connect = () => { From 6328a3f2629c35b1f03941fbd185d5a639deb4c9 Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 14:30:22 -0700 Subject: [PATCH 09/10] Remove likely unnecessary timeout settings --- tests/e2e/puppeteer.ts | 7 +++---- tests/e2e/tutorial.test.ts | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/e2e/puppeteer.ts b/tests/e2e/puppeteer.ts index d0cb33a65..cf6605923 100644 --- a/tests/e2e/puppeteer.ts +++ b/tests/e2e/puppeteer.ts @@ -34,7 +34,7 @@ type BrowserTestOutput = { } const beforeStartTimeout = 60 * 1000 // Wait for 1 minute for Electron to open (mostly for Windows) -const launchProtocolTimeout = 10 * 60 * 1000 // Creating the test dataset can take up to 10 minutes (mostly for Windows) +const protocolTimeout = 10 * 60 * 1000 // Creating the test dataset can take up to 10 minutes (mostly for Windows) export const connect = () => { @@ -52,7 +52,7 @@ export const connect = () => { }); const browserURL = `http://localhost:${electronDebugPort}` - const browser = output.browser = await puppeteer.launch({ headless: 'new', timeout: launchProtocolTimeout, protocolTimeout: launchProtocolTimeout, dumpio: true}) + const browser = output.browser = await puppeteer.launch({ headless: 'new'}) const page = output.page = await browser.newPage(); await page.goto(browserURL); const endpoint = await page.evaluate(() => fetch(`json/version`).then(res => res.json()).then(res => res.webSocketDebuggerUrl)) @@ -62,11 +62,10 @@ export const connect = () => { // Connect to browser WS Endpoint const browserWSEndpoint = endpoint.replace('localhost', '0.0.0.0') - output.browser = await puppeteer.connect({ browserWSEndpoint, defaultViewport: null, protocolTimeout: launchProtocolTimeout}) + output.browser = await puppeteer.connect({ browserWSEndpoint, defaultViewport: null, protocolTimeout: protocolTimeout}) const pages = await output.browser.pages() output.page = pages[0] - output.page.setDefaultTimeout(launchProtocolTimeout); }, beforeStartTimeout + 1000) diff --git a/tests/e2e/tutorial.test.ts b/tests/e2e/tutorial.test.ts index 17634912e..105de1262 100644 --- a/tests/e2e/tutorial.test.ts +++ b/tests/e2e/tutorial.test.ts @@ -37,6 +37,7 @@ describe('E2E Test', () => { const datasetTestFunction = config.regenerateTestData ? test : test.skip // Wait up to 10 minutes for dataset generation + // Both the test timeout and the protocolTimeout on puppeteer.connect() must be set to 10 min datasetTestFunction('Create tutorial dataset', { timeout: 10 * 60 * 1000 }, async () => { await evaluate(async () => { From 03da3e5d6261b94027f37165338309345b422548 Mon Sep 17 00:00:00 2001 From: rly Date: Fri, 23 Aug 2024 14:55:57 -0700 Subject: [PATCH 10/10] Increase beforeStartTimeout for failing macos example data test --- tests/e2e/puppeteer.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/e2e/puppeteer.ts b/tests/e2e/puppeteer.ts index cf6605923..1da3b4658 100644 --- a/tests/e2e/puppeteer.ts +++ b/tests/e2e/puppeteer.ts @@ -22,7 +22,7 @@ const beforeStart = (timeout) => new Promise(async (resolve, reject) => { process.stdout.on('data', handleOutput); process.stderr.on('data', handleOutput); process.on('close', (code) => console.log(`[electron] Exited with code ${code}`)); - await sleep(timeout) // Wait for five seconds for Electron to open + await sleep(timeout) reject('Failed to open Electron window successfully.') }) @@ -33,15 +33,13 @@ type BrowserTestOutput = { browser?: puppeteer.Browser, } -const beforeStartTimeout = 60 * 1000 // Wait for 1 minute for Electron to open (mostly for Windows) +const beforeStartTimeout = 2 * 60 * 1000 // Wait 2 minutes for Electron to open const protocolTimeout = 10 * 60 * 1000 // Creating the test dataset can take up to 10 minutes (mostly for Windows) export const connect = () => { - const output: BrowserTestOutput = {} - beforeAll(async () => { await beforeStart(beforeStartTimeout) @@ -52,7 +50,7 @@ export const connect = () => { }); const browserURL = `http://localhost:${electronDebugPort}` - const browser = output.browser = await puppeteer.launch({ headless: 'new'}) + const browser = output.browser = await puppeteer.launch({ headless: 'new' }) const page = output.page = await browser.newPage(); await page.goto(browserURL); const endpoint = await page.evaluate(() => fetch(`json/version`).then(res => res.json()).then(res => res.webSocketDebuggerUrl))