From cf152e5ba027a91a9b22872c7a1c4995b196cd9d Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 26 Jul 2024 11:08:46 +0100 Subject: [PATCH] fix linting errors in e2e --- .../remix-ide-e2e/src/commands/refreshPage.ts | 2 +- apps/remix-ide-e2e/src/commands/verifyLoad.ts | 62 +++++++-------- apps/remix-ide-e2e/src/helpers/init.ts | 76 ++++++++++--------- 3 files changed, 71 insertions(+), 69 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/refreshPage.ts b/apps/remix-ide-e2e/src/commands/refreshPage.ts index 03f58f0740..5147ceb839 100644 --- a/apps/remix-ide-e2e/src/commands/refreshPage.ts +++ b/apps/remix-ide-e2e/src/commands/refreshPage.ts @@ -1,4 +1,4 @@ -import {NightwatchBrowser} from 'nightwatch' +import { NightwatchBrowser } from 'nightwatch' import EventEmitter from 'events' class RefreshPage extends EventEmitter { diff --git a/apps/remix-ide-e2e/src/commands/verifyLoad.ts b/apps/remix-ide-e2e/src/commands/verifyLoad.ts index b89ff091a0..d069112e32 100644 --- a/apps/remix-ide-e2e/src/commands/verifyLoad.ts +++ b/apps/remix-ide-e2e/src/commands/verifyLoad.ts @@ -2,37 +2,37 @@ import { NightwatchBrowser } from 'nightwatch' import EventEmitter from 'events' class VerifyLoad extends EventEmitter { - command(this: NightwatchBrowser) { - browser.waitForElementPresent({ - selector: "//span[@data-id='typesloaded']", - locateStrategy: 'xpath', - timeout: 120000 - }) - .waitForElementPresent({ - selector: "//span[@data-id='editorloaded']", - locateStrategy: 'xpath', - timeout: 60000 - }) - .waitForElementPresent({ - selector: "//span[@data-id='workspaceloaded']", - locateStrategy: 'xpath', - timeout: 60000 - }) - .waitForElementPresent({ - selector: "//span[@data-id='apploaded']", - locateStrategy: 'xpath', - timeout: 60000 - }) - .waitForElementPresent({ - selector: "//span[@data-id='compilerloaded']", - locateStrategy: 'xpath', - timeout: 120000 - }) - .perform((done) => { - done() - this.emit('complete') - }) - } + command(this: NightwatchBrowser) { + browser.waitForElementPresent({ + selector: "//span[@data-id='typesloaded']", + locateStrategy: 'xpath', + timeout: 120000 + }) + .waitForElementPresent({ + selector: "//span[@data-id='editorloaded']", + locateStrategy: 'xpath', + timeout: 60000 + }) + .waitForElementPresent({ + selector: "//span[@data-id='workspaceloaded']", + locateStrategy: 'xpath', + timeout: 60000 + }) + .waitForElementPresent({ + selector: "//span[@data-id='apploaded']", + locateStrategy: 'xpath', + timeout: 60000 + }) + .waitForElementPresent({ + selector: "//span[@data-id='compilerloaded']", + locateStrategy: 'xpath', + timeout: 120000 + }) + .perform((done) => { + done() + this.emit('complete') + }) + } } module.exports = VerifyLoad diff --git a/apps/remix-ide-e2e/src/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts index e1aed5c6e4..f30ce3dd62 100644 --- a/apps/remix-ide-e2e/src/helpers/init.ts +++ b/apps/remix-ide-e2e/src/helpers/init.ts @@ -1,3 +1,4 @@ +/* eslint-disable prefer-rest-params */ import { NightwatchBrowser } from 'nightwatch' require('dotenv').config() @@ -7,6 +8,7 @@ type LoadPlugin = { url: string } +// eslint-disable-next-line @typescript-eslint/no-unused-vars export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true, loadPlugin?: LoadPlugin, hideToolTips: boolean = true): void { browser .url(url || 'http://127.0.0.1:8080') @@ -26,50 +28,50 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url .verifyLoad() .enableClipBoard() .perform((done) => { - browser.execute(function () { // hide tooltips - function addStyle(styleString) { - const style = document.createElement('style'); - style.textContent = styleString; - document.head.append(style); - } + browser.execute(function () { // hide tooltips + function addStyle(styleString) { + const style = document.createElement('style'); + style.textContent = styleString; + document.head.append(style); + } - addStyle(` + addStyle(` .popover { display:none !important; } `); - }, [], done()) - }) - .perform(() => { - browser.execute(function () { - (window as any).logs = []; - (console as any).browserLog = console.log; - (console as any).browserError = console.error - console.log = function () { - (window as any).logs.push(JSON.stringify(arguments)); - (console as any).browserLog(...arguments) - } - console.error = function () { - (window as any).logs.push(JSON.stringify(arguments)); - (console as any).browserError(...arguments) - } - }) - }) - .perform(() => { - if (preloadPlugins) { - initModules(browser, () => { - browser - .pause(4000) - .clickLaunchIcon('solidity') - .waitForElementVisible('[for="autoCompile"]') - .click('[for="autoCompile"]') - .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') - .perform(() => { callback() }) - }) - } else { - callback() + }, [], done()) + }) + .perform(() => { + browser.execute(function () { + (window as any).logs = []; + (console as any).browserLog = console.log; + (console as any).browserError = console.error + console.log = function () { + (window as any).logs.push(JSON.stringify(arguments)); + (console as any).browserLog(...arguments) + } + console.error = function () { + (window as any).logs.push(JSON.stringify(arguments)); + (console as any).browserError(...arguments) } }) + }) + .perform(() => { + if (preloadPlugins) { + initModules(browser, () => { + browser + .pause(4000) + .clickLaunchIcon('solidity') + .waitForElementVisible('[for="autoCompile"]') + .click('[for="autoCompile"]') + .verify.elementPresent('[data-id="compilerContainerAutoCompile"]:checked') + .perform(() => { callback() }) + }) + } else { + callback() + } + }) } function initModules(browser: NightwatchBrowser, callback: VoidFunction) {