diff --git a/lib/runner/test-runners/cucumber/_setup_cucumber_runner.js b/lib/runner/test-runners/cucumber/_setup_cucumber_runner.js index ff66b224a3..603a9bdac0 100644 --- a/lib/runner/test-runners/cucumber/_setup_cucumber_runner.js +++ b/lib/runner/test-runners/cucumber/_setup_cucumber_runner.js @@ -8,6 +8,8 @@ Before(function({pickle, testCaseStartedId}) { const webdriver = {}; process.env.CUCUMBER_TEST_CASE_STARTED_ID = testCaseStartedId; + // eslint-disable-next-line no-console + console.log('setup_cucumber_before', 'PID:', process.pid, 'testCaseStartedId:', testCaseStartedId); if (this.parameters['webdriver-host']) { webdriver.host = this.parameters['webdriver-host']; diff --git a/lib/runner/test-runners/cucumber/nightwatch-format.js b/lib/runner/test-runners/cucumber/nightwatch-format.js index ac13c26a2b..f32e5dde4a 100644 --- a/lib/runner/test-runners/cucumber/nightwatch-format.js +++ b/lib/runner/test-runners/cucumber/nightwatch-format.js @@ -27,6 +27,9 @@ module.exports = class NightwatchFormatter extends Formatter { static setCapabilities(data) { data = {...data, testCaseStartedId: process.env.CUCUMBER_TEST_CASE_STARTED_ID}; + // eslint-disable-next-line no-console + console.log('nightwatch_format_set_capability', 'PID:', process.pid, 'testCaseStartedId:', process.env.CUCUMBER_TEST_CASE_STARTED_ID); + if (isFunction(process.send)) { process.send({'jsonEnvelope': SafeJSON.stringify({ session: { @@ -39,6 +42,9 @@ module.exports = class NightwatchFormatter extends Formatter { } onSessionCapabilities(envelope) { + // eslint-disable-next-line no-console + console.log('nightwatch_format_onSessionCapabilities', 'PID:', process.pid, 'testCaseStartedId:', envelope.testCaseStartedId); + this.report.session = this.report.session || {}; this.report.session[envelope.testCaseStartedId] = envelope; @@ -82,6 +88,13 @@ module.exports = class NightwatchFormatter extends Formatter { this.report.testCaseFinished = this.report.testCaseFinished || {}; this.report.testCaseFinished[result.testCaseStartedId] = result; + if (!this.report.session[result.testCaseStartedId]) { + throw new Error('Session capabilities not found for', result.testCaseStartedId); + } + + // eslint-disable-next-line no-console + console.log('nightwatch_format_onTestCaseFinished', 'PID:', process.pid, 'testCaseStartedId:', result.testCaseStartedId); + NightwatchEventHub.emit(TestCaseFinished, { envelope: result, report: this.report