Wait for content timeout

pull/1041/head
ioedeveloper 4 years ago
parent 683eb80e50
commit 3988333730
  1. 4
      apps/remix-ide-e2e/src/commands/addFile.ts
  2. 19
      apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts
  3. 12
      apps/remix-ide-e2e/src/tests/compiler_api.test.ts
  4. 2
      apps/remix-ide-e2e/src/types/index.d.ts

@ -18,11 +18,11 @@ function addFile (browser: NightwatchBrowser, name: string, content: NightwatchC
.clickLaunchIcon('fileExplorers')
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]') // focus on root directory
.click('.newFile')
.waitForElementVisible('*[data-id="treeViewLitreeViewItem/blank"]')
.waitForElementVisible('*[data-id="treeViewLitreeViewItem/blank"]', 60000)
.sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', name)
.sendKeys('*[data-id="treeViewLitreeViewItem/blank"] .remixui_items', browser.Keys.ENTER)
.pause(2000)
.waitForElementVisible(`li[data-id="treeViewLitreeViewItem${name}"]`)
.waitForElementVisible(`li[data-id="treeViewLitreeViewItem${name}"]`, 60000)
.setEditorValue(content.content)
.pause(1000)
.perform(function () {

@ -2,22 +2,23 @@ import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'
class WaitForElementContainsText extends EventEmitter {
command (this: NightwatchBrowser, id: string, value: string): NightwatchBrowser {
let incr = 0
command (this: NightwatchBrowser, id: string, value: string, timeout = 10000): NightwatchBrowser {
let waitId // eslint-disable-line
const runid = setInterval(() => {
this.api.getText(id, (result) => {
if (typeof result.value === 'string' && value.indexOf(result.value || '') !== -1) {
if (typeof result.value === 'string' && result.value.indexOf(value) !== -1) {
clearInterval(runid)
this.api.assert.ok(true, `WaitForElementContainsText ${id} contains ${value}`)
clearTimeout(waitId)
this.api.assert.ok(true, `WaitForElementContainsText ${id} contains ${value} after ${timeout}`)
this.emit('complete')
} else incr++
if (incr > 50) {
clearInterval(runid)
this.api.assert.fail(`WaitForElementContainsText - expected ${value} but got ${result.value}`)
// throw new Error(`WaitForElementContainsText ${id} ${value}`)
}
})
}, 200)
waitId = setTimeout(() => {
clearInterval(runid)
this.api.assert.fail(`TimeoutError: An error occurred while running .waitForElementContainsText() command on ${id}`)
}, timeout)
return this
}
}

@ -22,8 +22,7 @@ module.exports = {
browser
.addFile('test_jsCompile.js', { content: jsCompile })
.executeScript('remix.exeCurrent()')
.pause(5000)
.journalChildIncludes('"languageversion": "0.6.8+commit.0bbfe453"')
.waitForElementContainsText('*[data-id="terminalJournal"]', '"languageversion": "0.6.8+commit.0bbfe453"', 60000)
.click('*[data-id="terminalClearConsole"]')
},
@ -31,8 +30,7 @@ module.exports = {
browser
.addFile('test_jsCompileWithOptimization.js', { content: jsCompileWithOptimization })
.executeScript('remix.exeCurrent()')
.pause(10000)
.journalChildIncludes('\\"optimizer\\":{\\"enabled\\":true,\\"runs\\":300}')
.waitForElementContainsText('*[data-id="terminalJournal"]', '\\"optimizer\\":{\\"enabled\\":true,\\"runs\\":300}', 60000)
.click('*[data-id="terminalClearConsole"]')
},
@ -40,8 +38,7 @@ module.exports = {
browser
.addFile('test_jsCompileWithOptimizationDefault.js', { content: jsCompileWithOptimizationDefault })
.executeScript('remix.exeCurrent()')
.pause(10000)
.journalChildIncludes('\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200}')
.waitForElementContainsText('*[data-id="terminalJournal"]', '\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200}', 60000)
.click('*[data-id="terminalClearConsole"]')
},
@ -60,8 +57,7 @@ module.exports = {
.click('li[data-id="treeViewLitreeViewItemREADME.txt"')
.addFile('ContractStackLimit.sol', { content: contractStackLimit })
.clickLaunchIcon('solidity')
.pause(10000)
.waitForElementContainsText('*[data-id="compiledErrors"]', 'CompilerError: Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack.')
.waitForElementContainsText('*[data-id="compiledErrors"]', 'CompilerError: Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack.', 60000)
.end()
},

@ -30,7 +30,7 @@ declare module "nightwatch" {
editorScroll(direction: 'up' | 'down', numberOfTimes: number): NightwatchBrowser,
renamePath(path: string, newFileName: string, renamedPath: string): NightwatchBrowser,
rightClick(cssSelector: string): NightwatchBrowser,
waitForElementContainsText(id: string, value: string): NightwatchBrowser,
waitForElementContainsText(id: string, value: string, timeout?: number): NightwatchBrowser,
getModalBody(callback: (value: string, cb: VoidFunction) => void): NightwatchBrowser,
modalFooterCancelClick(): NightwatchBrowser,
selectContract(contractName: string): NightwatchBrowser,

Loading…
Cancel
Save