diff --git a/src/spec/demoVideo.ts b/src/spec/demoVideo.ts index 6e175bc..4827d08 100644 --- a/src/spec/demoVideo.ts +++ b/src/spec/demoVideo.ts @@ -24,9 +24,6 @@ import { hideText, showText, sleep, - getHeapDump, - countInstancesOf, - ClassNameMapping } from './util' process.on('unhandledRejection', (error: Error) => { @@ -58,8 +55,14 @@ async function doStuff() { const browser = await webdriverio.remote(options) await createFakeMousePointer(browser) + // Wait for Username input to be visible - await browser.$(`//label[contains(text(), "Username")]/..//input`) + let inputField = undefined + let start = Date.now() + let maxWaitDuration = 30000 + while ((!inputField || !inputField.isExisting) && ((Date.now() - start) < maxWaitDuration)) { + inputField = await browser.$(`//label[contains(text(), "Username")]/..//input`) + } const scenes = new SceneBuilder() await scenes.record('connect', async () => { await connectTo('127.0.0.1', browser) diff --git a/src/spec/util/index.ts b/src/spec/util/index.ts index 4a5d72f..7389cc5 100644 --- a/src/spec/util/index.ts +++ b/src/spec/util/index.ts @@ -57,7 +57,7 @@ export async function moveToCenterOfElement(element: Element, browser: Bro const js = `window.demo.moveMouse(${targetX}, ${targetY}, ${duration});` await browser.execute(js) await sleep(duration) - await sleep(20, true) + await sleep(250, true) await element.moveTo() }