update e2e test

pull/3068/head
yann300 2 years ago
parent 8d40812c63
commit be1d382e6c
  1. 4
      apps/remix-ide-e2e/src/commands/waitForElementContainsText.ts

@ -4,8 +4,10 @@ import EventEmitter from 'events'
class WaitForElementContainsText extends EventEmitter { class WaitForElementContainsText extends EventEmitter {
command (this: NightwatchBrowser, id: string, value: string, timeout = 10000): NightwatchBrowser { command (this: NightwatchBrowser, id: string, value: string, timeout = 10000): NightwatchBrowser {
let waitId // eslint-disable-line let waitId // eslint-disable-line
let currentValue
const runid = setInterval(() => { const runid = setInterval(() => {
this.api.getText(id, (result) => { this.api.getText(id, (result) => {
currentValue = result.value
if (typeof result.value === 'string' && result.value.indexOf(value) !== -1) { if (typeof result.value === 'string' && result.value.indexOf(value) !== -1) {
clearInterval(runid) clearInterval(runid)
clearTimeout(waitId) clearTimeout(waitId)
@ -17,7 +19,7 @@ class WaitForElementContainsText extends EventEmitter {
waitId = setTimeout(() => { waitId = setTimeout(() => {
clearInterval(runid) clearInterval(runid)
this.api.assert.fail(`TimeoutError: An error occurred while running .waitForElementContainsText() command on ${id} after ${timeout} milliseconds`) this.api.assert.fail(`TimeoutError: An error occurred while running .waitForElementContainsText() command on ${id} after ${timeout} milliseconds. expected: ${value} - got: ${currentValue}`)
}, timeout) }, timeout)
return this return this
} }

Loading…
Cancel
Save