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)
  • Loading branch information
harshit-bs committed Aug 17, 2023
1 parent dab1de6 commit 0c2e119
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
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
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 0c2e119

Please sign in to comment.