Skip to content

Commit

Permalink
code refactoring for capabilities issue
Browse files Browse the repository at this point in the history
(cherry picked from commit 370c01e)
(cherry picked from commit 0c2e119)
  • Loading branch information
harshit-bs committed Aug 17, 2023
1 parent 0d5a9a0 commit 12b3cfe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
8 changes: 7 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,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
16 changes: 3 additions & 13 deletions lib/transport/selenium-webdriver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const CDP = require('./cdp.js');
const {colors} = Logger;
const {isErrorResponse, checkLegacyResponse, throwDecodedError, WebDriverError} = error;
const {IosSessionErrors} = require('../errors');
const {NightwatchEventHub} = require('../../runner/eventHub.js');

let _driverService = null;
let _driver = null;
Expand Down Expand Up @@ -298,20 +297,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 12b3cfe

Please sign in to comment.