diff --git a/apps/remix-ide-e2e/src/commands/openFile.ts b/apps/remix-ide-e2e/src/commands/openFile.ts index 28d09a009d..fa674e22a9 100644 --- a/apps/remix-ide-e2e/src/commands/openFile.ts +++ b/apps/remix-ide-e2e/src/commands/openFile.ts @@ -16,19 +16,25 @@ class OpenFile extends EventEmitter { // click on fileExplorer can toggle it. We go through settings to be sure FE is open function openFile (browser: NightwatchBrowser, name: string, done: VoidFunction) { browser.perform((done) => { - browser.element('css selector', '[data-id="verticalIconsKindfilePanel"] img[data-id="selected"]', (result) => { - console.log(result) - if (result.status === 0) { - browser.clickLaunchIcon('filePanel').perform(done) - } else done() + browser.isVisible('[data-id="remixIdeSidePanel"]', (result) => { + console.log(result) + if (result.value) { + // if side panel is shown, check this is the file panel + browser.element('css selector', '[data-id="verticalIconsKindfilePanel"] img[data-id="selected"]', (result) => { + console.log(result) + if (result.status === 0) { + done() + } else browser.clickLaunchIcon('filePanel').perform(done) }) - }) - .waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"', 60000) - .click('li[data-id="treeViewLitreeViewItem' + name + '"') - .pause(2000) - .perform(() => { - done() - }) + } else browser.clickLaunchIcon('filePanel').perform(done) + }) + }) + .waitForElementVisible('li[data-id="treeViewLitreeViewItem' + name + '"', 60000) + .click('li[data-id="treeViewLitreeViewItem' + name + '"') + .pause(2000) + .perform(() => { + done() + }) } module.exports = OpenFile