fix command

pull/5370/head
filip mertens 2 years ago
parent 15f2225924
commit 1c064a4363
  1. 19
      apps/remix-ide-e2e/src/commands/debugTransaction.ts

@ -2,7 +2,7 @@ import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events' import EventEmitter from 'events'
class debugTransaction extends EventEmitter { class debugTransaction extends EventEmitter {
command (this: NightwatchBrowser, index = 0): NightwatchBrowser { command(this: NightwatchBrowser, index = 0): NightwatchBrowser {
this.api.perform((done) => { this.api.perform((done) => {
checkStyle(this.api, index, () => { checkStyle(this.api, index, () => {
done() done()
@ -13,14 +13,27 @@ class debugTransaction extends EventEmitter {
} }
} }
function checkStyle (browser: NightwatchBrowser, index: number, callback: VoidFunction) { function checkStyle(browser: NightwatchBrowser, index: number, callback: VoidFunction) {
browser.pause(5000).execute(function (index: number) { let elementsFound = 0
browser.waitUntil(() => {
browser.findElements({
selector: '*[data-shared="txLoggerDebugButton"]',
timeout: 60000,
}, (result) => {
if (Array.isArray(result.value) && result.value.length > 0) {
elementsFound = result.value.length
}
})
return elementsFound > index
}, 60000)
.execute(function (index: number) {
const debugBtn = document.querySelectorAll('*[data-shared="txLoggerDebugButton"]')[index] as HTMLInputElement const debugBtn = document.querySelectorAll('*[data-shared="txLoggerDebugButton"]')[index] as HTMLInputElement
debugBtn && debugBtn.click() debugBtn && debugBtn.click()
}, [index], function () { }, [index], function () {
browser.waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]', 60000).perform(() => callback()) browser.waitForElementVisible('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]', 60000).perform(() => callback())
}) })
} }
module.exports = debugTransaction module.exports = debugTransaction

Loading…
Cancel
Save