From 51f6a52c913f32e574d3d7776bb25870f514d409 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 5 Nov 2024 07:57:23 +0100 Subject: [PATCH] helpers --- .../src/commands/hidePopUpPanel.ts | 32 +++++++++++++++++++ apps/remix-ide-e2e/src/helpers/init.ts | 11 ++----- apps/remix-ide-e2e/src/types/index.d.ts | 1 + 3 files changed, 35 insertions(+), 9 deletions(-) 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 new file mode 100644 index 0000000000..196f7b4476 --- /dev/null +++ b/apps/remix-ide-e2e/src/commands/hidePopUpPanel.ts @@ -0,0 +1,32 @@ +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/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts index a98c0b6ac6..2bf8244c31 100644 --- a/apps/remix-ide-e2e/src/helpers/init.ts +++ b/apps/remix-ide-e2e/src/helpers/init.ts @@ -14,15 +14,8 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url .url(url || 'http://127.0.0.1:8080') .pause(5000) .switchBrowserTab(0) - // get value from local storage - .execute(function () { - return localStorage.getItem('did_show_popup_panel') - }, [], function (result) { - if (!result.value) { - browser.waitForElementVisible('*[data-id="aiStatusButton"]') - .click('*[data-id="aiStatusButton"]') - } - }) + .hidePopUpPanel() + .pause() .perform((done) => { if (!loadPlugin) return done() browser diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts index 4a5b1831ee..d031b6c992 100644 --- a/apps/remix-ide-e2e/src/types/index.d.ts +++ b/apps/remix-ide-e2e/src/types/index.d.ts @@ -77,6 +77,7 @@ declare module 'nightwatch' { enableClipBoard: () => NightwatchBrowser addFileSnekmate: (name: string, content: NightwatchContractContent) => NightwatchBrowser selectFiles: (selelectedElements: any[]) => NightwatchBrowser + hidePopUpPanel: (this: NightwatchBrowser) => NightwatchBrowser } export interface NightwatchBrowser {