use isvisible

pull/2868/head
filip mertens 2 years ago
parent 47a68d9d83
commit 8f137c8848
  1. 13
      apps/remix-ide-e2e/src/commands/addFile.ts

@ -13,18 +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 browser
.saveScreenshot('./reports/screenshots/addFile.png') .saveScreenshot('./reports/screenshots/addFile.png')
.isVisible({ .isVisible({
selector: "//*[@data-id='sidePanelSwapitTitle' and contains(.,'File explorer')]", selector: "//*[@data-id='sidePanelSwapitTitle' and contains(.,'File explorer')]",
locateStrategy: 'xpath', locateStrategy: 'xpath',
suppressNotFoundErrors: true, suppressNotFoundErrors: true,
timeout: 1000 timeout: 1000
}, (okVisible) => { }, (okVisible) => {
if (!okVisible.value) { if (!okVisible.value) {
browser.clickLaunchIcon('filePanel') browser.clickLaunchIcon('filePanel')
.saveScreenshot('./reports/screenshots/addFile2.png') .saveScreenshot('./reports/screenshots/addFile2.png')
} }
}) })
.scrollInto('li[data-id="treeViewLitreeViewItemREADME.txt"]') .scrollInto('li[data-id="treeViewLitreeViewItemREADME.txt"]')
@ -37,10 +37,9 @@ function addFile (browser: NightwatchBrowser, name: string, content: NightwatchC
abortOnFailure: false, abortOnFailure: false,
suppressNotFoundErrors: true, suppressNotFoundErrors: true,
timeout: 2000 timeout: 2000
}) }, (okVisible) => {
.elements('css selector', `li[data-id="treeViewLitreeViewItem${name}"]`, (res) => { // @ts-ignore
console.log(res) if (okVisible.status === 0) {
if (res.value && (res.value as any).length > 0) {
browser.openFile(name) browser.openFile(name)
.perform(function () { .perform(function () {
done() done()

Loading…
Cancel
Save