From 1fe1d1db50d437736de611271ed4a02c9d7b910c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Kr=C3=B6nert?= Date: Mon, 11 Jan 2021 08:39:34 +0100 Subject: [PATCH] Improved user name awaiting during login --- src/xrm/XrmUITest.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xrm/XrmUITest.ts b/src/xrm/XrmUITest.ts index aa8f0a7..97deda3 100644 --- a/src/xrm/XrmUITest.ts +++ b/src/xrm/XrmUITest.ts @@ -400,11 +400,15 @@ export class XrmUiTest { } private async enterPassword(extendedProperties: OpenProperties) { + await Promise.race([ + this.page.waitForSelector(D365Selectors.Login.password), + this.page.waitForNavigation({ waitUntil: "load", timeout: this.settings.timeout }) + ]); + const password = await this.page.$(D365Selectors.Login.password); + // For non online authentification, wait for custom login page to settle if (!password) { - await this.page.waitForNavigation({ waitUntil: "load" }); - console.log(`No online auth, handling custom auth. If nothing happens, please specify passwordFieldSelector and optionally userNameFieldSelector.`); if (extendedProperties.userNameFieldSelector) {