Skip to content

Commit

Permalink
chore(test): logLevel debug in proxy test (#3427)
Browse files Browse the repository at this point in the history
The test fails flaky but we don't have hints. Now a failing test should dump the
debug text
  • Loading branch information
johnjbarton authored Feb 20, 2020
1 parent da9d8bd commit 00d536f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 7 additions & 4 deletions test/e2e/step_definitions/core_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
}
Expand All @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/upstream-proxy.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

0 comments on commit 00d536f

Please sign in to comment.