Added usingWorker tests

nightwatch-ts
ioedeveloper 4 years ago
parent ece2553ae0
commit 959fe18351
  1. 29
      apps/remix-ide-e2e/src/commands/noWorkerErrorFor.ts
  2. 52
      apps/remix-ide-e2e/src/tests/usingWebWorker.test.ts
  3. 3
      apps/remix-ide-e2e/src/types/index.d.ts

@ -0,0 +1,29 @@
import { NightwatchBrowser } from "nightwatch"
import EventEmitter from "events"
class NoWorkerErrorFor extends EventEmitter {
command (this: NightwatchBrowser, version: string): NightwatchBrowser {
this.api.perform((done: VoidFunction) => {
noWorkerErrorFor(this.api, version, () => {
done()
this.emit('complete')
})
})
return this
}
}
function noWorkerErrorFor (browser: NightwatchBrowser, version: string, callback: VoidFunction) {
browser
.setSolidityCompilerVersion(version)
.click('*[data-id="compilerContainerCompileBtn"]')
.waitForElementPresent('*[data-id="compilationFinishedWith_' + version + '"]', 10000)
.notContainsText('*[data-id="compiledErrors"]', 'worker error:undefined')
.notContainsText('*[data-id="compiledErrors"]', 'Uncaught RangeError: Maximum call stack size exceeded')
.notContainsText('*[data-id="compiledErrors"]', 'RangeError: Maximum call stack size exceeded')
.perform(() => {
callback()
})
}
module.exports = NoWorkerErrorFor

@ -0,0 +1,52 @@
'use strict'
import init from '../helpers/init'
import sauce from './sauce'
import { NightwatchBrowser } from 'nightwatch'
const sources = [
{'browser/basic.sol': { content:
`pragma solidity >=0.2.0 <0.7.0;
/**
* @title Basic contract
*/
contract Basic {
uint someVar;
constructor() public {}
}`
}}
]
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done)
},
'@sources': function () {
return sources
},
'Using Web Worker': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers')
.addFile('browser/basic.sol', sources[0]['browser/basic.sol'])
.clickLaunchIcon('solidity')
.execute(function() {
const elem = document.getElementById('nightlies') as HTMLInputElement
elem.checked = true
})
.noWorkerErrorFor('soljson-v0.3.4+commit.7dab8902.js')
.noWorkerErrorFor('soljson-v0.6.5+commit.f956cc89.js')
.noWorkerErrorFor('soljson-v0.6.8-nightly.2020.5.14+commit.a6d0067b.js')
.noWorkerErrorFor('soljson-v0.6.0-nightly.2019.12.17+commit.d13438ee.js')
.noWorkerErrorFor('soljson-v0.4.26+commit.4563c3fc.js')
.execute(function() {
const elem = document.getElementById('nightlies') as HTMLInputElement
elem.checked = false
})
.end()
},
tearDown: sauce
}

@ -50,7 +50,8 @@ declare module "nightwatch" {
notContainsText(cssSelector: string, text: string): NightwatchBrowser, notContainsText(cssSelector: string, text: string): NightwatchBrowser,
sendLowLevelTx(address: string, value: string, callData: string): NightwatchBrowser, sendLowLevelTx(address: string, value: string, callData: string): NightwatchBrowser,
journalLastChild(val: string): NightwatchBrowser, journalLastChild(val: string): NightwatchBrowser,
checkTerminalFilter(filter: string, test: string): NightwatchBrowser checkTerminalFilter(filter: string, test: string): NightwatchBrowser,
noWorkerErrorFor(version: string): NightwatchBrowser
} }
export interface NightwatchBrowser { export interface NightwatchBrowser {

Loading…
Cancel
Save