From 44e7d2e95a60e467ecb70021f50ab72578106682 Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Wed, 19 Feb 2020 16:59:37 -0800 Subject: [PATCH] chore(test): logLevel debug in proxy test The test fails flaky but we don't have hints. Now a failing test should dump the debug text --- test/e2e/step_definitions/core_steps.js | 11 +++++++---- test/e2e/upstream-proxy.feature | 5 ++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/e2e/step_definitions/core_steps.js b/test/e2e/step_definitions/core_steps.js index 3651cb41c..040281355 100644 --- a/test/e2e/step_definitions/core_steps.js +++ b/test/e2e/step_definitions/core_steps.js @@ -180,17 +180,18 @@ cucumber.defineSupportCode((a) => { }) When('I {command} Karma behind a proxy on port {int} that prepends {string} to the base path', function (command, proxyPort, proxyPath, callback) { - execKarma.apply(this, [command, undefined, proxyPort, proxyPath, callback]) + execKarma.apply(this, [command, 'debug', proxyPort, proxyPath, callback]) }) defineParameterType({ name: 'exact', - regexp: /no\sdebug|like/ + regexp: /no\sdebug|like|regexp/ }) Then('it passes with( {exact}):', { timeout: 10 * 1000 }, function (mode, expectedOutput, callback) { const noDebug = mode === 'no debug' const like = mode === 'like' + const regexp = mode === 'regexp' let actualOutput = this.lastRun.stdout.toString() let lines @@ -203,7 +204,9 @@ cucumber.defineSupportCode((a) => { if (like && actualOutput.indexOf(expectedOutput) >= 0) { return callback() } - + if (regexp && actualOutput.match(expectedOutput)) { + return callback() + } if (actualOutput.indexOf(expectedOutput) === 0) { return callback() } @@ -212,7 +215,7 @@ cucumber.defineSupportCode((a) => { return callback(new Error('Expected output to match the following:\n ' + expectedOutput + '\nGot:\n ' + actualOutput)) } - callback(new Error('Failed all comparissons')) + callback(new Error('Failed all comparisons')) }) Then('it fails with:', function (expectedOutput, callback) { diff --git a/test/e2e/upstream-proxy.feature b/test/e2e/upstream-proxy.feature index 96db7b7ba..9b19c5709 100644 --- a/test/e2e/upstream-proxy.feature +++ b/test/e2e/upstream-proxy.feature @@ -18,8 +18,7 @@ Feature: UpstreamProxy }; """ When I start Karma behind a proxy on port 9875 that prepends '/__proxy__/' to the base path - Then it passes with: + Then it passes with regexp: """ - .. - HeadlessChrome + HeadlessChrome.*Executed.*SUCCESS """