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