parent
43084d19b6
commit
71a86d5756
@ -1,22 +1,17 @@ |
|||||||
import { NightwatchBrowser } from 'nightwatch' |
import { NightwatchBrowser } from 'nightwatch'; |
||||||
import EventEmitter from 'events' |
import EventEmitter from 'events'; |
||||||
|
|
||||||
const selector = '.udapp_contractNames' |
const selector = '.udapp_contractNames'; |
||||||
|
|
||||||
class SelectContract extends EventEmitter { |
class SelectContract extends EventEmitter { |
||||||
command (this: NightwatchBrowser, contractName: string): NightwatchBrowser { |
command(this: NightwatchBrowser, contractName: string): NightwatchBrowser { |
||||||
this.api.waitForElementVisible(selector).perform((done) => { |
this.api |
||||||
selectContract(this.api, contractName, () => { |
.waitForElementVisible(selector) |
||||||
done() |
.waitForElementPresent(`${selector} option[value="${contractName}"]`) |
||||||
this.emit('complete') |
.click(`${selector} option[value="${contractName}"]`) |
||||||
}) |
.perform(() => this.emit('complete')); |
||||||
}) |
return this; |
||||||
return this |
|
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
function selectContract (browser: NightwatchBrowser, contractName: string, callback: VoidFunction) { |
module.exports = SelectContract; |
||||||
browser.click(`${selector} option[value="${contractName}"]`).perform(() => callback()) |
|
||||||
} |
|
||||||
|
|
||||||
module.exports = SelectContract |
|
||||||
|
Loading…
Reference in new issue