|
|
|
@ -2,7 +2,7 @@ import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch' |
|
|
|
|
import EventEmitter from 'events' |
|
|
|
|
|
|
|
|
|
class AddFile extends EventEmitter { |
|
|
|
|
command (this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser { |
|
|
|
|
command(this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser { |
|
|
|
|
this.api.perform((done) => { |
|
|
|
|
addFile(this.api, name, content, () => { |
|
|
|
|
done() |
|
|
|
@ -13,9 +13,18 @@ class AddFile extends EventEmitter { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) { |
|
|
|
|
browser.clickLaunchIcon('udapp') |
|
|
|
|
.clickLaunchIcon('filePanel') |
|
|
|
|
function addFile(browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) { |
|
|
|
|
browser |
|
|
|
|
.isVisible({ |
|
|
|
|
selector: "//*[@data-id='sidePanelSwapitTitle' and contains(.,'File explorer')]", |
|
|
|
|
locateStrategy: 'xpath', |
|
|
|
|
suppressNotFoundErrors: true, |
|
|
|
|
timeout: 1000 |
|
|
|
|
}, (okVisible) => { |
|
|
|
|
if (!okVisible.value) { |
|
|
|
|
browser.clickLaunchIcon('filePanel') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]') |
|
|
|
|
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]').pause(1000) // focus on root directory
|
|
|
|
|
.elements('css selector', `li[data-id="treeViewLitreeViewItem${name}"]`, (res) => { |
|
|
|
|