fix linting errors in e2e

pull/5062/head
Joseph Izang 4 months ago committed by Aniket
parent 2b75b9cc17
commit cf152e5ba0
  1. 2
      apps/remix-ide-e2e/src/commands/refreshPage.ts
  2. 62
      apps/remix-ide-e2e/src/commands/verifyLoad.ts
  3. 76
      apps/remix-ide-e2e/src/helpers/init.ts

@ -1,4 +1,4 @@
import {NightwatchBrowser} from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events' import EventEmitter from 'events'
class RefreshPage extends EventEmitter { class RefreshPage extends EventEmitter {

@ -2,37 +2,37 @@ import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events' import EventEmitter from 'events'
class VerifyLoad extends EventEmitter { class VerifyLoad extends EventEmitter {
command(this: NightwatchBrowser) { command(this: NightwatchBrowser) {
browser.waitForElementPresent({ browser.waitForElementPresent({
selector: "//span[@data-id='typesloaded']", selector: "//span[@data-id='typesloaded']",
locateStrategy: 'xpath', locateStrategy: 'xpath',
timeout: 120000 timeout: 120000
}) })
.waitForElementPresent({ .waitForElementPresent({
selector: "//span[@data-id='editorloaded']", selector: "//span[@data-id='editorloaded']",
locateStrategy: 'xpath', locateStrategy: 'xpath',
timeout: 60000 timeout: 60000
}) })
.waitForElementPresent({ .waitForElementPresent({
selector: "//span[@data-id='workspaceloaded']", selector: "//span[@data-id='workspaceloaded']",
locateStrategy: 'xpath', locateStrategy: 'xpath',
timeout: 60000 timeout: 60000
}) })
.waitForElementPresent({ .waitForElementPresent({
selector: "//span[@data-id='apploaded']", selector: "//span[@data-id='apploaded']",
locateStrategy: 'xpath', locateStrategy: 'xpath',
timeout: 60000 timeout: 60000
}) })
.waitForElementPresent({ .waitForElementPresent({
selector: "//span[@data-id='compilerloaded']", selector: "//span[@data-id='compilerloaded']",
locateStrategy: 'xpath', locateStrategy: 'xpath',
timeout: 120000 timeout: 120000
}) })
.perform((done) => { .perform((done) => {
done() done()
this.emit('complete') this.emit('complete')
}) })
} }
} }
module.exports = VerifyLoad module.exports = VerifyLoad

@ -1,3 +1,4 @@
/* eslint-disable prefer-rest-params */
import { NightwatchBrowser } from 'nightwatch' import { NightwatchBrowser } from 'nightwatch'
require('dotenv').config() require('dotenv').config()
@ -7,6 +8,7 @@ type LoadPlugin = {
url: string 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 { export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true, loadPlugin?: LoadPlugin, hideToolTips: boolean = true): void {
browser browser
.url(url || 'http://127.0.0.1:8080') .url(url || 'http://127.0.0.1:8080')
@ -26,50 +28,50 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url
.verifyLoad() .verifyLoad()
.enableClipBoard() .enableClipBoard()
.perform((done) => { .perform((done) => {
browser.execute(function () { // hide tooltips browser.execute(function () { // hide tooltips
function addStyle(styleString) { function addStyle(styleString) {
const style = document.createElement('style'); const style = document.createElement('style');
style.textContent = styleString; style.textContent = styleString;
document.head.append(style); document.head.append(style);
} }
addStyle(` addStyle(`
.popover { .popover {
display:none !important; display:none !important;
} }
`); `);
}, [], done()) }, [], done())
}) })
.perform(() => { .perform(() => {
browser.execute(function () { browser.execute(function () {
(window as any).logs = []; (window as any).logs = [];
(console as any).browserLog = console.log; (console as any).browserLog = console.log;
(console as any).browserError = console.error (console as any).browserError = console.error
console.log = function () { console.log = function () {
(window as any).logs.push(JSON.stringify(arguments)); (window as any).logs.push(JSON.stringify(arguments));
(console as any).browserLog(...arguments) (console as any).browserLog(...arguments)
} }
console.error = function () { console.error = function () {
(window as any).logs.push(JSON.stringify(arguments)); (window as any).logs.push(JSON.stringify(arguments));
(console as any).browserError(...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()
} }
}) })
})
.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) { function initModules(browser: NightwatchBrowser, callback: VoidFunction) {

Loading…
Cancel
Save