From 8ad589c4d1be35232694e17f38de06c1614b213d Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 12 Oct 2018 17:08:58 -0700 Subject: [PATCH 1/2] Provide better errors if launching the browser failed --- korebuild.json | 8 +++++++- test/FunctionalTests/test.js | 24 +++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/korebuild.json b/korebuild.json index d217d06e3e..78afb8c137 100644 --- a/korebuild.json +++ b/korebuild.json @@ -1,4 +1,10 @@ { "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.2/tools/korebuild.schema.json", - "channel": "release/2.2" + "channel": "release/2.2", + "toolsets": { + "nodejs": { + "required": true, + "minVersion": "8.0" + } + } } diff --git a/test/FunctionalTests/test.js b/test/FunctionalTests/test.js index 2fc14652e1..0f81bd3597 100644 --- a/test/FunctionalTests/test.js +++ b/test/FunctionalTests/test.js @@ -10,19 +10,37 @@ const debug = process.env.npm_config_debug || false; jest.setTimeout(debug ? 60000 : 30000); let browser; +let error; beforeAll(async () => { const options = debug ? { headless: false, slowMo: 100 } : { args: ['--no-sandbox'] }; - browser = await puppeteer.launch(options); - expect(browser).toBeDefined(); + + try { + browser = await puppeteer.launch(options); + } catch (ex) { + error = ex; + } }); afterAll(async () => { - await browser.close(); + if (browser) { + await browser.close(); + } }); +describe('Browser is initialized', () => { + // Workaround for https://github.com/jasmine/jasmine/issues/1533. + // Jasmine will not report errors from beforeAll and instead fail all the tests that + // expect the browser to be available. This test allows us to ensure the setup was successful + // and if unsuccessful report the error + test('no errors on launch', () => { + expect(error).toBeUndefined(); + expect(browser).toBeDefined(); + }) +}) + describe('CORS allowed origin tests ', () => { const testPagePath = `http://${hostname}:9001/`; let page; From 393815b8ad5c0b694fcf33e2ceffbff07f686e5b Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 16 Oct 2018 09:57:34 -0700 Subject: [PATCH 2/2] Increase test timeout to accomodate slow machines --- test/FunctionalTests/ProcessManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/FunctionalTests/ProcessManager.cs b/test/FunctionalTests/ProcessManager.cs index 9689a2da7d..77bebe26c8 100644 --- a/test/FunctionalTests/ProcessManager.cs +++ b/test/FunctionalTests/ProcessManager.cs @@ -11,7 +11,7 @@ namespace FunctionalTests { internal static class ProcessManager { - private static readonly TimeSpan Timeout = TimeSpan.FromSeconds(60); + private static readonly TimeSpan Timeout = TimeSpan.FromMinutes(3); public static Task RunProcessAsync(ProcessStartInfo processStartInfo) {