dh-auth-library 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -169,8 +169,13 @@ var ADLoginPage = class ADLoginPage extends nl_portal_playwright_libraries.BaseP
169
169
  sessionWasStale = await this.page.getByText("Uw account is niet geverifieerd. Probeer het opnieuw").isVisible().catch(() => false);
170
170
  });
171
171
  await _playwright_test.test.step("Complete MFA via TOTP", async () => {
172
- if (!sessionWasStale) await adLoginPage.cannotUseAuthAppLink.click();
173
- await adLoginPage.useVerificationCode.click();
172
+ const mfaScreen = adLoginPage.cannotUseAuthAppLink.or(adLoginPage.useVerificationCode).or(adLoginPage.codeInput).filter({ visible: true }).first();
173
+ if (await Promise.race([this.page.waitForURL((url) => url.origin === targetOrigin, {
174
+ waitUntil: "commit",
175
+ timeout: 3e4
176
+ }).then(() => true), mfaScreen.waitFor({ timeout: 3e4 }).then(() => false)])) return;
177
+ if (!sessionWasStale && await adLoginPage.cannotUseAuthAppLink.isVisible()) await adLoginPage.cannotUseAuthAppLink.click();
178
+ if (!await adLoginPage.codeInput.isVisible()) await adLoginPage.useVerificationCode.click();
174
179
  const token = await totp_generator.TOTP.generate(`${process.env.AD_SECRET}`);
175
180
  await maskedFill(adLoginPage.codeInput, token.otp, "otp", true);
176
181
  await adLoginPage.verifyInput.click();
package/dist/index.es.js CHANGED
@@ -144,8 +144,13 @@ var ADLoginPage = class ADLoginPage extends BasePage {
144
144
  sessionWasStale = await this.page.getByText("Uw account is niet geverifieerd. Probeer het opnieuw").isVisible().catch(() => false);
145
145
  });
146
146
  await test.step("Complete MFA via TOTP", async () => {
147
- if (!sessionWasStale) await adLoginPage.cannotUseAuthAppLink.click();
148
- await adLoginPage.useVerificationCode.click();
147
+ const mfaScreen = adLoginPage.cannotUseAuthAppLink.or(adLoginPage.useVerificationCode).or(adLoginPage.codeInput).filter({ visible: true }).first();
148
+ if (await Promise.race([this.page.waitForURL((url) => url.origin === targetOrigin, {
149
+ waitUntil: "commit",
150
+ timeout: 3e4
151
+ }).then(() => true), mfaScreen.waitFor({ timeout: 3e4 }).then(() => false)])) return;
152
+ if (!sessionWasStale && await adLoginPage.cannotUseAuthAppLink.isVisible()) await adLoginPage.cannotUseAuthAppLink.click();
153
+ if (!await adLoginPage.codeInput.isVisible()) await adLoginPage.useVerificationCode.click();
149
154
  const token = await TOTP.generate(`${process.env.AD_SECRET}`);
150
155
  await maskedFill(adLoginPage.codeInput, token.otp, "otp", true);
151
156
  await adLoginPage.verifyInput.click();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dh-auth-library",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Gemeente-DenHaag/dh-auth-library.git"