Skip to content

Commit

Permalink
code refactoring for capabilities issue
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-bs committed Aug 17, 2023
1 parent 1306847 commit 370c01e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
8 changes: 7 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ module.exports.createClient = function({
.then(() => {
return client.createSession({argv});
})
.then(_ => {
.then((data) => {
if (this.settings.test_runner?.type === 'cucumber' && NightwatchEventHub.isAvailable) {
const NightwatchFormatter = require('./runner/test-runners/cucumber/nightwatch-format');

NightwatchFormatter.setCapabilities(data);
}

return client.api;
})
.catch((error) => {
Expand Down
17 changes: 3 additions & 14 deletions lib/transport/selenium-webdriver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const CDP = require('./cdp.js');
const {colors} = Logger;
const {isErrorResponse, checkLegacyResponse, throwDecodedError, WebDriverError} = error;

const {NightwatchEventHub} = require('../../runner/eventHub.js');

let _driverService = null;
let _driver = null;

Expand Down Expand Up @@ -297,20 +295,11 @@ class Transport extends BaseTransport {
this.__elementKey = elementKey;
await this.showConnectInfo({startTime, host, port, start_process, sessionInfo});

if (this.settings.test_runner?.type === 'cucumber' && NightwatchEventHub.isAvailable) {
const NightwatchFormatter = require('../../runner/test-runners/cucumber/nightwatch-format.js');

NightwatchFormatter.setCapabilities({
sessionId,
capabilities,
host,
port
});
}

return {
sessionId,
capabilities
capabilities,
host,
port
};
} catch (err) {
const error = this.handleConnectError(err);
Expand Down

0 comments on commit 370c01e

Please sign in to comment.