parent
d98d4fcd3b
commit
d06f811cf3
@ -0,0 +1,22 @@ |
|||||||
|
import EventEmitter from "events" |
||||||
|
import { NightwatchBrowser } from "nightwatch" |
||||||
|
|
||||||
|
class SelectFiles extends EventEmitter { |
||||||
|
command (this: NightwatchBrowser, selectedElements: any[]): NightwatchBrowser { |
||||||
|
const browser = this.api |
||||||
|
|
||||||
|
browser.perform(function () { |
||||||
|
const actions = this.actions({ async: true }) |
||||||
|
actions.keyDown(this.Keys.SHIFT) |
||||||
|
for(let i = 0; i < selectedElements.length; i++) { |
||||||
|
actions.click(selectedElements[i].value) |
||||||
|
} |
||||||
|
return actions.contextClick(selectedElements[0].value) |
||||||
|
}) |
||||||
|
this.emit('complete') |
||||||
|
return this |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
module.exports = SelectFiles |
@ -0,0 +1,29 @@ |
|||||||
|
import { NightwatchBrowser } from 'nightwatch' |
||||||
|
import init from '../helpers/init' |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
before: function (browser: NightwatchBrowser, done: VoidFunction) { |
||||||
|
init(browser, done) |
||||||
|
}, |
||||||
|
|
||||||
|
'Should select multiple items in file explorer #group1': function (browser: NightwatchBrowser) { |
||||||
|
const selectedElements = [] |
||||||
|
browser |
||||||
|
.openFile('contracts') |
||||||
|
browser |
||||||
|
.click({ selector: '//*[@data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]', locateStrategy: 'xpath' }) |
||||||
|
browser |
||||||
|
.findElement({ selector: '//*[@data-id="treeViewLitreeViewItemcontracts/2_Owner.sol"]', locateStrategy: 'xpath' }, (el) => { |
||||||
|
selectedElements.push(el) |
||||||
|
}) |
||||||
|
browser |
||||||
|
.findElement({ selector: '//*[@data-id="treeViewLitreeViewItemtests"]', locateStrategy: 'xpath' }, (el) => { |
||||||
|
selectedElements.push(el) |
||||||
|
}) |
||||||
|
browser.selectFiles(selectedElements) |
||||||
|
.assert.visible('.bg-secondary[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]') |
||||||
|
.assert.visible('.bg-secondary[data-id="treeViewLitreeViewItemcontracts/2_Owner.sol"]') |
||||||
|
.assert.visible('.bg-secondary[data-id="treeViewLitreeViewItemtests"]') |
||||||
|
.end() |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue