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'
class RefreshPage extends EventEmitter {

@ -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

@ -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) {

Loading…
Cancel
Save