@bigbinary/neeto-playwright-commons 3.3.5 → 3.3.7

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/index.cjs.js CHANGED
@@ -17611,45 +17611,49 @@ class GooglePage extends IntegrationBase {
17611
17611
  .click();
17612
17612
  await test.expect(signInHeading).toBeHidden({ timeout: 10_000 });
17613
17613
  };
17614
- loginToGoogle = () => withCookieCache("google", this.page.context(), async () => {
17615
- if (ramda.isNil(process.env.GOOGLE_LOGIN_EMAIL) ||
17616
- ramda.isNil(process.env.GOOGLE_LOGIN_PASSWORD)) {
17617
- throw new Error("ENV variable GOOGLE_LOGIN_EMAIL or GOOGLE_LOGIN_PASSWORD is not properly configured");
17618
- }
17619
- await this.page.goto(THIRD_PARTY_ROUTES.google.signin, {
17620
- timeout: 20_000,
17621
- });
17622
- await this.page
17623
- .getByLabel(GOOGLE_LOGIN_TEXTS.emailOrPhone)
17624
- .pressSequentially(process.env.GOOGLE_LOGIN_EMAIL, { delay: 10 });
17625
- await this.page
17626
- .getByRole("button", { name: GOOGLE_LOGIN_TEXTS.next })
17627
- .click();
17628
- await this.page.waitForLoadState("load", { timeout: 25_000 });
17629
- await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.password));
17630
- await test.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.showPassword)).toBeVisible({ timeout: 10_000 });
17631
- await this.page
17632
- .getByLabel(GOOGLE_LOGIN_TEXTS.enterYourPassword)
17633
- .pressSequentially(process.env.GOOGLE_LOGIN_PASSWORD, {
17634
- delay: 10,
17635
- timeout: 20_000,
17636
- });
17637
- await this.page.getByLabel(GOOGLE_LOGIN_TEXTS.showPassword).click();
17638
- await this.page
17639
- .getByRole("button", { name: GOOGLE_LOGIN_TEXTS.next })
17640
- .click();
17641
- this.page
17642
- .url()
17643
- .includes(THIRD_PARTY_ROUTES.google.challengeSelection) &&
17644
- (await this.page
17645
- .locator(GOOGLE_LOGIN_SELECTORS.totpChallengeSelector)
17646
- .click());
17647
- await this.page.waitForLoadState("load", { timeout: 25_000 });
17648
- await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.totpChallenge));
17649
- await this.enterTotpCode();
17650
- await this.page.waitForLoadState("load", { timeout: 25_000 });
17651
- await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount));
17652
- }, ["google.com"]);
17614
+ loginToGoogle = async () => {
17615
+ if (IS_DEV_ENV)
17616
+ return;
17617
+ return withCookieCache("google", this.page.context(), async () => {
17618
+ if (ramda.isNil(process.env.GOOGLE_LOGIN_EMAIL) ||
17619
+ ramda.isNil(process.env.GOOGLE_LOGIN_PASSWORD)) {
17620
+ throw new Error("ENV variable GOOGLE_LOGIN_EMAIL or GOOGLE_LOGIN_PASSWORD is not properly configured");
17621
+ }
17622
+ await this.page.goto(THIRD_PARTY_ROUTES.google.signin, {
17623
+ timeout: 20_000,
17624
+ });
17625
+ await this.page
17626
+ .getByLabel(GOOGLE_LOGIN_TEXTS.emailOrPhone)
17627
+ .pressSequentially(process.env.GOOGLE_LOGIN_EMAIL, { delay: 10 });
17628
+ await this.page
17629
+ .getByRole("button", { name: GOOGLE_LOGIN_TEXTS.next })
17630
+ .click();
17631
+ await this.page.waitForLoadState("load", { timeout: 25_000 });
17632
+ await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.password));
17633
+ await test.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.showPassword)).toBeVisible({ timeout: 10_000 });
17634
+ await this.page
17635
+ .getByLabel(GOOGLE_LOGIN_TEXTS.enterYourPassword)
17636
+ .pressSequentially(process.env.GOOGLE_LOGIN_PASSWORD, {
17637
+ delay: 10,
17638
+ timeout: 20_000,
17639
+ });
17640
+ await this.page.getByLabel(GOOGLE_LOGIN_TEXTS.showPassword).click();
17641
+ await this.page
17642
+ .getByRole("button", { name: GOOGLE_LOGIN_TEXTS.next })
17643
+ .click();
17644
+ this.page
17645
+ .url()
17646
+ .includes(THIRD_PARTY_ROUTES.google.challengeSelection) &&
17647
+ (await this.page
17648
+ .locator(GOOGLE_LOGIN_SELECTORS.totpChallengeSelector)
17649
+ .click());
17650
+ await this.page.waitForLoadState("load", { timeout: 25_000 });
17651
+ await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.totpChallenge));
17652
+ await this.enterTotpCode();
17653
+ await this.page.waitForLoadState("load", { timeout: 25_000 });
17654
+ await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount));
17655
+ }, ["google.com"]);
17656
+ };
17653
17657
  enterTotpCode = async () => {
17654
17658
  let previousToken = null;
17655
17659
  const codeInput = this.page.getByLabel(GOOGLE_LOGIN_TEXTS.enterCode);
@@ -17678,6 +17682,8 @@ class GooglePage extends IntegrationBase {
17678
17682
  }).toPass({ timeout: 2 * 60 * 1000 });
17679
17683
  };
17680
17684
  logoutFromGoogle = async () => {
17685
+ if (IS_DEV_ENV)
17686
+ return;
17681
17687
  await this.page.goto(THIRD_PARTY_ROUTES.google.myAccount, {
17682
17688
  timeout: 20_000,
17683
17689
  });
@@ -119703,29 +119709,36 @@ class MicrosoftPage extends IntegrationBase {
119703
119709
  }))
119704
119710
  .pressSequentially(process.env.MICROSOFT_LOGIN_PASSWORD, { delay: 15 });
119705
119711
  };
119706
- loginToMicrosoft = () => withCookieCache("microsoft", this.page.context(), async () => {
119707
- if (ramda.isNil(process.env.MICROSOFT_LOGIN_EMAIL) ||
119708
- ramda.isNil(process.env.MICROSOFT_LOGIN_PASSWORD) ||
119709
- ramda.isNil(process.env.MICROSOFT_2FA_SECRET_KEY)) {
119710
- throw new Error("ENV variable MICROSOFT_LOGIN_EMAIL or MICROSOFT_LOGIN_PASSWORD or MICROSOFT_2FA_SECRET_KEY is not properly configured");
119711
- }
119712
- await this.page.goto(THIRD_PARTY_ROUTES.microsoft.login);
119713
- await this.enterEmail();
119714
- await this.page
119715
- .getByRole("button", { name: MICROSOFT_LOGIN_TEXTS.next })
119716
- .click();
119717
- await this.enterPassword();
119718
- await this.page
119719
- .getByRole("button", { name: MICROSOFT_LOGIN_TEXTS.signIn })
119720
- .click();
119721
- await this.page
119722
- .getByRole("button", {
119723
- name: MICROSOFT_LOGIN_TEXTS.useVerificationCode,
119724
- })
119725
- .click();
119726
- await this.enterTotpCode();
119727
- await this.staySignedIn();
119728
- }, ["microsoft.com", "live.com", "microsoftonline.com"]);
119712
+ loginToMicrosoft = async () => {
119713
+ if (IS_DEV_ENV)
119714
+ return;
119715
+ return withCookieCache("microsoft", this.page.context(), async () => {
119716
+ if (ramda.isNil(process.env.MICROSOFT_LOGIN_EMAIL) ||
119717
+ ramda.isNil(process.env.MICROSOFT_LOGIN_PASSWORD) ||
119718
+ ramda.isNil(process.env.MICROSOFT_2FA_SECRET_KEY)) {
119719
+ throw new Error("ENV variable MICROSOFT_LOGIN_EMAIL or MICROSOFT_LOGIN_PASSWORD or MICROSOFT_2FA_SECRET_KEY is not properly configured");
119720
+ }
119721
+ const useVerificationCodeButton = this.page.getByRole("button", {
119722
+ name: MICROSOFT_LOGIN_TEXTS.useVerificationCode,
119723
+ });
119724
+ await this.page.goto(THIRD_PARTY_ROUTES.microsoft.login);
119725
+ await this.enterEmail();
119726
+ await this.page
119727
+ .getByRole("button", { name: MICROSOFT_LOGIN_TEXTS.next })
119728
+ .click();
119729
+ await this.enterPassword();
119730
+ const signInButton = this.page.getByRole("button", {
119731
+ name: MICROSOFT_LOGIN_TEXTS.signIn,
119732
+ });
119733
+ await signInButton.click();
119734
+ await test.expect(signInButton).toBeHidden({ timeout: 10_000 });
119735
+ await this.page.waitForLoadState("load", { timeout: 25_000 });
119736
+ (await useVerificationCodeButton.isVisible({ timeout: 20_000 })) &&
119737
+ (await useVerificationCodeButton.click());
119738
+ await this.enterTotpCode();
119739
+ await this.staySignedIn();
119740
+ }, ["microsoft.com", "live.com", "microsoftonline.com"]);
119741
+ };
119729
119742
  enterTotpCode = async () => {
119730
119743
  const verifyBtn = this.page.getByRole("button", {
119731
119744
  name: MICROSOFT_LOGIN_TEXTS.verify,