Fixed failing tests

pull/906/head
ioedeveloper 4 years ago
parent 7dee925e9b
commit 638178ddf7
  1. 14
      apps/remix-ide-e2e/src/commands/testFunction.ts
  2. 4
      apps/remix-ide-e2e/src/tests/recorder.test.ts

@ -7,7 +7,9 @@ class TestFunction extends EventEmitter {
command (this: NightwatchBrowser, txHash: string, expectedValue: NightwatchTestFunctionExpectedInput): NightwatchBrowser { command (this: NightwatchBrowser, txHash: string, expectedValue: NightwatchTestFunctionExpectedInput): NightwatchBrowser {
const browser = this.api const browser = this.api
const logs = {} const logs = {}
const setLog = (index: number, value: string) => { logs[Object.keys(logs)[index]] = typeof value === 'string' ? value.trim() : value } const setLog = (index: number, value: string) => {
logs[Object.keys(logs)[index]] = typeof value === 'string' ? value.indexOf('Copy value to clipboard') ? value.split('\n').shift().trim(): value.trim() : value
}
browser browser
.waitForElementVisible(`[data-id="block_tx${txHash}"]`) .waitForElementVisible(`[data-id="block_tx${txHash}"]`)
@ -45,7 +47,15 @@ class TestFunction extends EventEmitter {
browser.perform(() => { browser.perform(() => {
Object.keys(expectedValue).forEach(key => { Object.keys(expectedValue).forEach(key => {
const equal: boolean = deepequal(logs[key], expectedValue[key]) let equal = false
try {
const receivedValue = JSON.parse(logs[key])
equal = deepequal(receivedValue, expectedValue[key])
} catch (err) {
equal = deepequal(logs[key], expectedValue[key])
}
if (!equal) { if (!equal) {
browser.assert.fail(`Expected ${JSON.stringify(expectedValue[key])} but got ${JSON.stringify(logs[key])}`) browser.assert.fail(`Expected ${JSON.stringify(expectedValue[key])} but got ${JSON.stringify(logs[key])}`)

@ -14,9 +14,7 @@ module.exports = {
'Test Recorder': function (browser: NightwatchBrowser) { 'Test Recorder': function (browser: NightwatchBrowser) {
let addressRef let addressRef
browser browser.addFile('scenario.json', { content: records })
.pause(50000)
.addFile('scenario.json', { content: records })
.pause(5000) .pause(5000)
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') // this account will be used for this test suite

Loading…
Cancel
Save