From 578036f5765f30f57792bad28902f44346a0bbea Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 5 Nov 2024 08:10:16 +0100 Subject: [PATCH] hide panel command --- .../src/commands/hidePopUpPanel.ts | 32 ------------------- .../src/commands/hidePopupPanel.ts | 25 +++++++++++++++ apps/remix-ide-e2e/src/helpers/init.ts | 2 +- apps/remix-ide-e2e/src/types/index.d.ts | 2 +- .../test/tests/app/compiler.test.ts | 1 + .../test/tests/app/externaleditor.test.ts | 1 + .../test/tests/app/foundry.test.ts | 1 + apps/remixdesktop/test/tests/app/gist.test.ts | 1 + .../test/tests/app/git-ui.test.ts | 2 +- .../test/tests/app/git-ui_2.test.ts | 2 +- .../test/tests/app/git-ui_3.test.ts | 2 +- .../test/tests/app/git-ui_4.test.ts | 2 +- apps/remixdesktop/test/tests/app/git.test.ts | 1 + .../test/tests/app/github.test.ts | 2 +- .../test/tests/app/github_2.test.ts | 2 +- .../test/tests/app/github_3.test.ts | 2 +- .../test/tests/app/hardhat.test.ts | 1 + .../test/tests/app/offline.test.ts | 1 + .../test/tests/app/search.test.ts | 1 + .../test/tests/app/slitherlinux.test.ts | 1 + .../test/tests/app/templates.test.ts | 1 + .../remixdesktop/test/tests/app/xterm.test.ts | 1 + .../test/tests/app/xtermwin.test.ts | 1 + apps/remixdesktop/test/types/index.d.ts | 1 + 24 files changed, 47 insertions(+), 41 deletions(-) delete mode 100644 apps/remix-ide-e2e/src/commands/hidePopUpPanel.ts create mode 100644 apps/remix-ide-e2e/src/commands/hidePopupPanel.ts diff --git a/apps/remix-ide-e2e/src/commands/hidePopUpPanel.ts b/apps/remix-ide-e2e/src/commands/hidePopUpPanel.ts deleted file mode 100644 index 196f7b4476..0000000000 --- a/apps/remix-ide-e2e/src/commands/hidePopUpPanel.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { NightwatchBrowser } from 'nightwatch' -import EventEmitter from 'events' - -class HidePopUpPanel extends EventEmitter { - command(this: NightwatchBrowser) { - browser - .perform((done) => { - browser.execute(function () { - // hide tooltips - function addStyle(styleString) { - const style = document.createElement('style') - style.textContent = styleString - document.head.append(style) - } - addStyle(` - .popover { - display:none !important; - } - #scamDetails { - display:none !important; - } - `) - }, [], done()) - }) - .perform((done) => { - done() - this.emit('complete') - }) - } -} - -module.exports = HidePopUpPanel diff --git a/apps/remix-ide-e2e/src/commands/hidePopupPanel.ts b/apps/remix-ide-e2e/src/commands/hidePopupPanel.ts new file mode 100644 index 0000000000..29baee5523 --- /dev/null +++ b/apps/remix-ide-e2e/src/commands/hidePopupPanel.ts @@ -0,0 +1,25 @@ +import { NightwatchBrowser } from 'nightwatch' +import EventEmitter from 'events' + +class HidePopupPanel extends EventEmitter { + command(this: NightwatchBrowser) { + browser + .perform((done) => { + browser.execute(function () { + return localStorage.getItem('did_show_popup_panel') + }, [], function (result) { + if (!result.value) { + browser.waitForElementVisible('*[data-id="aiStatusButton"]') + .click('*[data-id="aiStatusButton"]') + } + done() + }) + }) + .perform((done) => { + done() + this.emit('complete') + }) + } +} + +module.exports = HidePopupPanel diff --git a/apps/remix-ide-e2e/src/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts index 2bf8244c31..1caa647862 100644 --- a/apps/remix-ide-e2e/src/helpers/init.ts +++ b/apps/remix-ide-e2e/src/helpers/init.ts @@ -14,7 +14,7 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url .url(url || 'http://127.0.0.1:8080') .pause(5000) .switchBrowserTab(0) - .hidePopUpPanel() + .hidePopupPanel() .pause() .perform((done) => { if (!loadPlugin) return done() diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts index d031b6c992..5c6d3bd262 100644 --- a/apps/remix-ide-e2e/src/types/index.d.ts +++ b/apps/remix-ide-e2e/src/types/index.d.ts @@ -74,10 +74,10 @@ declare module 'nightwatch' { connectToExternalHttpProvider: (url: string, identifier: string) => NightwatchBrowser waitForElementNotContainsText: (id: string, value: string, timeout: number = 10000) => NightwatchBrowser hideToolTips: (this: NightwatchBrowser) => NightwatchBrowser + hidePopupPanel: (this: NightwatchBrowser) => NightwatchBrowser enableClipBoard: () => NightwatchBrowser addFileSnekmate: (name: string, content: NightwatchContractContent) => NightwatchBrowser selectFiles: (selelectedElements: any[]) => NightwatchBrowser - hidePopUpPanel: (this: NightwatchBrowser) => NightwatchBrowser } export interface NightwatchBrowser { diff --git a/apps/remixdesktop/test/tests/app/compiler.test.ts b/apps/remixdesktop/test/tests/app/compiler.test.ts index 2fce46320c..7da49f2685 100644 --- a/apps/remixdesktop/test/tests/app/compiler.test.ts +++ b/apps/remixdesktop/test/tests/app/compiler.test.ts @@ -3,6 +3,7 @@ import { NightwatchBrowser } from 'nightwatch' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, 'download compiler': function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/externaleditor.test.ts b/apps/remixdesktop/test/tests/app/externaleditor.test.ts index 89e991fdcd..75d074bb00 100644 --- a/apps/remixdesktop/test/tests/app/externaleditor.test.ts +++ b/apps/remixdesktop/test/tests/app/externaleditor.test.ts @@ -2,6 +2,7 @@ import {NightwatchBrowser} from 'nightwatch' const testsBash = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, open: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/foundry.test.ts b/apps/remixdesktop/test/tests/app/foundry.test.ts index 3aa370882a..a0457f6ee9 100644 --- a/apps/remixdesktop/test/tests/app/foundry.test.ts +++ b/apps/remixdesktop/test/tests/app/foundry.test.ts @@ -9,6 +9,7 @@ const dir = '/tmp/' + projectDir const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, installFoundry: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/gist.test.ts b/apps/remixdesktop/test/tests/app/gist.test.ts index b53c741910..443581eb0f 100644 --- a/apps/remixdesktop/test/tests/app/gist.test.ts +++ b/apps/remixdesktop/test/tests/app/gist.test.ts @@ -3,6 +3,7 @@ import { NightwatchBrowser } from 'nightwatch' const gist_id = '02a847917a6a7ecaf4a7e0d4e68715bf' const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, 'start gist': function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/git-ui.test.ts b/apps/remixdesktop/test/tests/app/git-ui.test.ts index 813c31da44..ba954da076 100644 --- a/apps/remixdesktop/test/tests/app/git-ui.test.ts +++ b/apps/remixdesktop/test/tests/app/git-ui.test.ts @@ -13,7 +13,7 @@ let gitserver: ChildProcess const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - browser.hideToolTips() + browser.hideToolTips().hidePopupPanel() done() }, after: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/git-ui_2.test.ts b/apps/remixdesktop/test/tests/app/git-ui_2.test.ts index 6a1f3b598b..cd1679a732 100644 --- a/apps/remixdesktop/test/tests/app/git-ui_2.test.ts +++ b/apps/remixdesktop/test/tests/app/git-ui_2.test.ts @@ -13,7 +13,7 @@ let gitserver: ChildProcess const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - browser.hideToolTips() + browser.hideToolTips().hidePopupPanel() done() }, after: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/git-ui_3.test.ts b/apps/remixdesktop/test/tests/app/git-ui_3.test.ts index 6fb96951ff..83906f9285 100644 --- a/apps/remixdesktop/test/tests/app/git-ui_3.test.ts +++ b/apps/remixdesktop/test/tests/app/git-ui_3.test.ts @@ -13,7 +13,7 @@ let gitserver: ChildProcess const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - browser.hideToolTips() + browser.hideToolTips().hidePopupPanel() done() }, after: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/git-ui_4.test.ts b/apps/remixdesktop/test/tests/app/git-ui_4.test.ts index 521462122d..a82a0ad8b9 100644 --- a/apps/remixdesktop/test/tests/app/git-ui_4.test.ts +++ b/apps/remixdesktop/test/tests/app/git-ui_4.test.ts @@ -13,7 +13,7 @@ let gitserver: ChildProcess const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - browser.hideToolTips() + browser.hideToolTips().hidePopupPanel() done() }, after: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/git.test.ts b/apps/remixdesktop/test/tests/app/git.test.ts index 9cc26be3d0..a4f92f4bab 100644 --- a/apps/remixdesktop/test/tests/app/git.test.ts +++ b/apps/remixdesktop/test/tests/app/git.test.ts @@ -4,6 +4,7 @@ import { NightwatchBrowser } from 'nightwatch' module.exports = { '@isogit': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, 'clone a repo': function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/github.test.ts b/apps/remixdesktop/test/tests/app/github.test.ts index 612be7e02f..7e3f83265a 100644 --- a/apps/remixdesktop/test/tests/app/github.test.ts +++ b/apps/remixdesktop/test/tests/app/github.test.ts @@ -3,7 +3,7 @@ import { NightwatchBrowser } from "nightwatch" const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - browser.hideToolTips() + browser.hideToolTips().hidePopupPanel() done() }, diff --git a/apps/remixdesktop/test/tests/app/github_2.test.ts b/apps/remixdesktop/test/tests/app/github_2.test.ts index 3b02b3746c..55f011dee2 100644 --- a/apps/remixdesktop/test/tests/app/github_2.test.ts +++ b/apps/remixdesktop/test/tests/app/github_2.test.ts @@ -3,7 +3,7 @@ import { NightwatchBrowser } from "nightwatch" const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - browser.hideToolTips() + browser.hideToolTips().hidePopupPanel() done() }, diff --git a/apps/remixdesktop/test/tests/app/github_3.test.ts b/apps/remixdesktop/test/tests/app/github_3.test.ts index 12542bb86f..3bcc366964 100644 --- a/apps/remixdesktop/test/tests/app/github_3.test.ts +++ b/apps/remixdesktop/test/tests/app/github_3.test.ts @@ -5,7 +5,7 @@ let commitCount = 0 let branchCount = 0 const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { - browser.hideToolTips() + browser.hideToolTips().hidePopupPanel() done() }, diff --git a/apps/remixdesktop/test/tests/app/hardhat.test.ts b/apps/remixdesktop/test/tests/app/hardhat.test.ts index f8c093102e..a9ca651595 100644 --- a/apps/remixdesktop/test/tests/app/hardhat.test.ts +++ b/apps/remixdesktop/test/tests/app/hardhat.test.ts @@ -8,6 +8,7 @@ const dir = path.join('remix-desktop-test-' + Date.now().toString()) const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, setuphardhat: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/offline.test.ts b/apps/remixdesktop/test/tests/app/offline.test.ts index 284d44991a..48f308b7eb 100644 --- a/apps/remixdesktop/test/tests/app/offline.test.ts +++ b/apps/remixdesktop/test/tests/app/offline.test.ts @@ -4,6 +4,7 @@ import { NightwatchBrowser } from 'nightwatch' module.exports = { '@offline': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, 'open default template': function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/search.test.ts b/apps/remixdesktop/test/tests/app/search.test.ts index 8f3ba0a9e7..7b5824d800 100644 --- a/apps/remixdesktop/test/tests/app/search.test.ts +++ b/apps/remixdesktop/test/tests/app/search.test.ts @@ -3,6 +3,7 @@ import { NightwatchBrowser } from 'nightwatch' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, 'open default template': function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/slitherlinux.test.ts b/apps/remixdesktop/test/tests/app/slitherlinux.test.ts index 21b3f38ea5..8af6d2ea6d 100644 --- a/apps/remixdesktop/test/tests/app/slitherlinux.test.ts +++ b/apps/remixdesktop/test/tests/app/slitherlinux.test.ts @@ -3,6 +3,7 @@ import { ChildProcess, spawn, execSync } from 'child_process' import { homedir } from 'os' const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, open: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/templates.test.ts b/apps/remixdesktop/test/tests/app/templates.test.ts index 86528458e9..78d36507e9 100644 --- a/apps/remixdesktop/test/tests/app/templates.test.ts +++ b/apps/remixdesktop/test/tests/app/templates.test.ts @@ -3,6 +3,7 @@ import { NightwatchBrowser } from 'nightwatch' module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, 'open default template': function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/xterm.test.ts b/apps/remixdesktop/test/tests/app/xterm.test.ts index df238fbcc9..c7c32c0303 100644 --- a/apps/remixdesktop/test/tests/app/xterm.test.ts +++ b/apps/remixdesktop/test/tests/app/xterm.test.ts @@ -5,6 +5,7 @@ import {NightwatchBrowser} from 'nightwatch' const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, open: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/tests/app/xtermwin.test.ts b/apps/remixdesktop/test/tests/app/xtermwin.test.ts index cf7b1e5be4..f714d736cf 100644 --- a/apps/remixdesktop/test/tests/app/xtermwin.test.ts +++ b/apps/remixdesktop/test/tests/app/xtermwin.test.ts @@ -2,6 +2,7 @@ import {NightwatchBrowser} from 'nightwatch' const tests = { before: function (browser: NightwatchBrowser, done: VoidFunction) { + browser.hidePopupPanel() done() }, open: function (browser: NightwatchBrowser) { diff --git a/apps/remixdesktop/test/types/index.d.ts b/apps/remixdesktop/test/types/index.d.ts index faf3a89d54..2a67630e60 100644 --- a/apps/remixdesktop/test/types/index.d.ts +++ b/apps/remixdesktop/test/types/index.d.ts @@ -71,6 +71,7 @@ declare module 'nightwatch' { connectToExternalHttpProvider: (url: string, identifier: string) => NightwatchBrowser waitForElementNotContainsText: (id: string, value: string, timeout: number = 10000) => NightwatchBrowser hideToolTips: (this: NightwatchBrowser) => NightwatchBrowser + hidePopupPanel: (this: NightwatchBrowser) => NightwatchBrowser enableClipBoard: () => NightwatchBrowser }