|
|
@ -2,40 +2,40 @@ import { NightwatchBrowser } from 'nightwatch' |
|
|
|
import EventEmitter from 'events' |
|
|
|
import EventEmitter from 'events' |
|
|
|
|
|
|
|
|
|
|
|
class ConnectToExternalHttpProvider extends EventEmitter { |
|
|
|
class ConnectToExternalHttpProvider extends EventEmitter { |
|
|
|
command(this: NightwatchBrowser, url: string, identifier: string): NightwatchBrowser { |
|
|
|
command(this: NightwatchBrowser, url: string, identifier: string): NightwatchBrowser { |
|
|
|
this.api.element('xpath', `//*[@class='udapp_environment' and contains(.,'${identifier}')]`, |
|
|
|
this.api.element('xpath', `//*[@class='udapp_environment' and contains(.,'${identifier}')]`, |
|
|
|
(result) => { |
|
|
|
(result) => { |
|
|
|
if (result.status as any === -1) { |
|
|
|
if (result.status as any === -1) { |
|
|
|
console.log("No connection to external provider found. Adding one.", url) |
|
|
|
console.log("No connection to external provider found. Adding one.", url) |
|
|
|
browser |
|
|
|
browser |
|
|
|
.click({ |
|
|
|
.click({ |
|
|
|
locateStrategy: 'css selector', |
|
|
|
locateStrategy: 'css selector', |
|
|
|
selector: '[data-id="basic-http-provider-modal-footer-ok-react"]', |
|
|
|
selector: '[data-id="basic-http-provider-modal-footer-ok-react"]', |
|
|
|
abortOnFailure: false, |
|
|
|
abortOnFailure: false, |
|
|
|
suppressNotFoundErrors: true, |
|
|
|
suppressNotFoundErrors: true, |
|
|
|
timeout: 5000 |
|
|
|
timeout: 5000 |
|
|
|
}) |
|
|
|
}) |
|
|
|
.switchEnvironment('basic-http-provider') |
|
|
|
.switchEnvironment('basic-http-provider') |
|
|
|
.waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') |
|
|
|
.waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') |
|
|
|
.execute(() => { |
|
|
|
.execute(() => { |
|
|
|
(document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() |
|
|
|
(document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() |
|
|
|
}, [], () => { }) |
|
|
|
}, [], () => { }) |
|
|
|
.setValue('[data-id="modalDialogCustomPromp"]', url) |
|
|
|
.setValue('[data-id="modalDialogCustomPromp"]', url) |
|
|
|
.modalFooterOKClick('basic-http-provider') |
|
|
|
.modalFooterOKClick('basic-http-provider') |
|
|
|
.perform((done) => { |
|
|
|
.perform((done) => { |
|
|
|
done() |
|
|
|
done() |
|
|
|
this.emit('complete') |
|
|
|
this.emit('complete') |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.api.perform((done) => { |
|
|
|
this.api.perform((done) => { |
|
|
|
done() |
|
|
|
done() |
|
|
|
this.emit('complete') |
|
|
|
this.emit('complete') |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
return this |
|
|
|
return this |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = ConnectToExternalHttpProvider |
|
|
|
module.exports = ConnectToExternalHttpProvider |
|
|
|