fix url wait add checks for connection add pause before clearing use css on start rm resolve refactor use timer add timeout selector strategy usecss abortfail slower rm end tests mv no logs url lint identifier unflaky from fail correctly increase timeout mv interval test with ganache only unused varpull/5370/head
parent
0fd0e2bf6e
commit
c4cb4f7e5b
@ -0,0 +1,42 @@ |
||||
import { NightwatchBrowser } from 'nightwatch' |
||||
import EventEmitter from 'events' |
||||
|
||||
class ConnectToExternalHttpProvider extends EventEmitter { |
||||
command(this: NightwatchBrowser, url: string, identifier: string): NightwatchBrowser { |
||||
this.api.element('xpath', `//*[@class='udapp_environment' and contains(.,'${identifier}')]`, |
||||
(result) => { |
||||
console.log('ConnectToExternalHttpProvider: ' + result.status, result.value) |
||||
if (result.status as any === -1 ) { |
||||
console.log("No connection to external provider found. Adding one.", url) |
||||
browser |
||||
.click({ |
||||
locateStrategy: 'css selector', |
||||
selector: '[data-id="basic-http-provider-modal-footer-ok-react"]', |
||||
abortOnFailure: false, |
||||
suppressNotFoundErrors: true, |
||||
timeout: 5000 |
||||
}) |
||||
.switchEnvironment('External Http Provider') |
||||
.waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') |
||||
.execute(() => { |
||||
(document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() |
||||
}, [], () => { }) |
||||
.setValue('[data-id="modalDialogCustomPromp"]', url) |
||||
.modalFooterOKClick('basic-http-provider') |
||||
.perform((done) => { |
||||
done() |
||||
this.emit('complete') |
||||
}) |
||||
} else { |
||||
this.api.perform((done) => { |
||||
done() |
||||
this.emit('complete') |
||||
}) |
||||
} |
||||
} |
||||
) |
||||
return this |
||||
} |
||||
} |
||||
|
||||
module.exports = ConnectToExternalHttpProvider |
Loading…
Reference in new issue