Fixed failing tests

nightwatch-ts
ioedeveloper 4 years ago
parent 1004777fd1
commit a25678ec8f
  1. 8
      apps/remix-ide-e2e/src/commands/getAddressAtPosition.ts
  2. 6
      apps/remix-ide-e2e/src/commands/getEditorValue.ts
  3. 4
      apps/remix-ide-e2e/src/commands/getModalBody.ts
  4. 3
      apps/remix-ide-e2e/src/tests/libraryDeployment.test.ts

@ -4,7 +4,7 @@ import EventEmitter from "events"
class GetAddressAtPosition extends EventEmitter {
command (this: NightwatchBrowser, index: number, cb: (pos: string) => void): NightwatchBrowser {
this.api.perform((done) => {
getAddressAtPosition(this.api, index, (pos: string) => {
getAddressAtPosition(this.api, index, (pos) => {
done()
cb(pos)
this.emit('complete')
@ -14,7 +14,7 @@ class GetAddressAtPosition extends EventEmitter {
}
}
function getAddressAtPosition (browser: NightwatchBrowser, index: number, callback: (pos: any) => void) {
function getAddressAtPosition (browser: NightwatchBrowser, index: number, callback: (pos: string) => void) {
browser.waitForElementPresent('*[data-shared="universalDappUiInstance"]')
.execute(function (index) {
const deployedContracts = document.querySelectorAll('*[data-shared="universalDappUiInstance"]')
@ -22,7 +22,9 @@ function getAddressAtPosition (browser: NightwatchBrowser, index: number, callba
return id.replace('instance', '')
}, [index], function (result) {
callback(result.value)
const pos = typeof result.value === 'string' ? result.value : null
callback(pos)
})
}

@ -7,10 +7,12 @@ class GetEditorValue extends EventEmitter {
this.api.execute(function () {
const elem: any = document.getElementById('input')
elem.editor.getValue()
return elem.editor.getValue()
}, [], (result) => {
done()
typeof result.value === 'string' && callback(result.value)
const value = typeof result.value === 'string' ? result.value : null
callback(value)
this.emit('complete')
})
})

@ -6,7 +6,9 @@ class GetModalBody extends EventEmitter {
this.api.waitForElementVisible('.modal-body')
.getText('.modal-body', (result) => {
console.log(result)
typeof result.value === 'string' && callback(result.value, () => {
const value = typeof result.value === 'string' ? result.value : null
callback(value, () => {
this.emit('complete')
})
})

@ -76,6 +76,9 @@ function checkDeployShouldFail (browser: NightwatchBrowser, callback: VoidFuncti
.openFile('browser/Untitled5.sol')
.selectContract('test') // deploy lib
.createContract('')
.getText('div[class^="terminal"]', (value) => {
console.log('value: ', value)
})
.assert.containsText('div[class^="terminal"]', '<address> is not a valid address')
.perform(() => { callback() })
}

Loading…
Cancel
Save