pull/5370/head
filip mertens 2 years ago
parent 077a15f548
commit 3234fd3961
  1. 17
      apps/remix-ide-e2e/src/commands/addFile.ts

@ -2,7 +2,7 @@ import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from 'events' import EventEmitter from 'events'
class AddFile extends EventEmitter { class AddFile extends EventEmitter {
command (this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser { command(this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser {
this.api.perform((done) => { this.api.perform((done) => {
addFile(this.api, name, content, () => { addFile(this.api, name, content, () => {
done() done()
@ -13,9 +13,18 @@ class AddFile extends EventEmitter {
} }
} }
function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) { function addFile(browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) {
browser.clickLaunchIcon('udapp') browser
.clickLaunchIcon('filePanel') .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"]') .waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]').pause(1000) // focus on root directory .click('li[data-id="treeViewLitreeViewItemREADME.txt"]').pause(1000) // focus on root directory
.elements('css selector', `li[data-id="treeViewLitreeViewItem${name}"]`, (res) => { .elements('css selector', `li[data-id="treeViewLitreeViewItem${name}"]`, (res) => {

Loading…
Cancel
Save