@bigbinary/neeto-playwright-commons 1.26.10 → 1.26.11

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
@@ -5317,6 +5317,7 @@ const SIGNUP_SELECTORS = {
5317
5317
  signupViaEmailButton: "signup-via-email-button",
5318
5318
  submitButton: "signup-email-submit-button",
5319
5319
  subdomainNameTextField: "signup-organization-subdomain-text-field",
5320
+ subdomainAvailabilityMsg: "subdomain-availability-message",
5320
5321
  subdomainError: "subdomain-input-error",
5321
5322
  tryFreeButton: "neeto-auth-signup-link",
5322
5323
  /** @deprecated Use unregisteredEmailError instead. */
@@ -116440,7 +116441,7 @@ class GooglePage extends IntegrationBase {
116440
116441
  .click();
116441
116442
  await this.page.waitForLoadState("load", { timeout: 25000 });
116442
116443
  await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.password));
116443
- await test.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.showPassword)).toBeVisible();
116444
+ await test.expect(this.page.getByText(GOOGLE_LOGIN_TEXTS.showPassword)).toBeVisible({ timeout: 10000 });
116444
116445
  await this.page
116445
116446
  .getByLabel(GOOGLE_LOGIN_TEXTS.enterYourPassword)
116446
116447
  .pressSequentially(process.env.GOOGLE_LOGIN_PASSWORD, { delay: 10 });
@@ -116459,7 +116460,7 @@ class GooglePage extends IntegrationBase {
116459
116460
  level: 2,
116460
116461
  exact: true,
116461
116462
  });
116462
- await test.expect(twoStepVerification).toBeVisible();
116463
+ await test.expect(twoStepVerification).toBeVisible({ timeout: 15000 });
116463
116464
  await this.enterTotpCode(twoStepVerification);
116464
116465
  await this.page.waitForLoadState("load", { timeout: 25000 });
116465
116466
  await this.page.waitForURL(new RegExp(THIRD_PARTY_ROUTES.google.myAccount));
@@ -118506,22 +118507,29 @@ class OrganizationPage {
118506
118507
  const { subdomainName } = getGlobalUserState();
118507
118508
  return `https://${subdomainName}.${appName}.net`;
118508
118509
  };
118510
+ this.fillOTP = async (otp = faker.faker.string.numeric(6)) => {
118511
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
118512
+ const otpTextBox = this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox);
118513
+ await otpTextBox.fill(otp);
118514
+ await test.expect(otpTextBox).toBeHidden({ timeout: 35000 });
118515
+ };
118516
+ this.submitEmail = async (email) => {
118517
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
118518
+ await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
118519
+ const submitButton = this.page.getByTestId(SIGNUP_SELECTORS.submitButton);
118520
+ await submitButton.click();
118521
+ await test.expect(submitButton).toBeHidden({ timeout: 35000 });
118522
+ };
118509
118523
  this.createOrganization = async ({ email, businessName, subdomainName, firstName, lastName, appName, }) => {
118510
118524
  if (!IS_STAGING_ENV || shouldSkipSetupAndTeardown())
118511
118525
  return;
118512
- const defaultOtp = "123456";
118513
118526
  const appNameInLowerCase = appName.toLowerCase();
118514
118527
  const isNeetoAuth = appNameInLowerCase === "neetoauth";
118515
118528
  isNeetoAuth
118516
118529
  ? await this.page.goto(ROUTES.neetoAuthSignup, { timeout: 20000 })
118517
118530
  : await this.page.goto(`${ROUTES.neetoAuthSignup}?redirect_uri=${appNameInLowerCase}.net/admin`, { timeout: 20000 });
118518
- await this.neetoPlaywrightUtilities.waitForPageLoad();
118519
- const submitButton = this.page.getByTestId(SIGNUP_SELECTORS.submitButton);
118520
- await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
118521
- await submitButton.click();
118522
- await test.expect(submitButton).toBeHidden({ timeout: 30000 });
118523
- await this.neetoPlaywrightUtilities.waitForPageLoad();
118524
- await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(defaultOtp);
118531
+ await this.submitEmail(email);
118532
+ await this.fillOTP();
118525
118533
  await this.fillOrganizationDetails({
118526
118534
  credentials: {
118527
118535
  firstName,
@@ -118595,6 +118603,7 @@ class OrganizationPage {
118595
118603
  }
118596
118604
  };
118597
118605
  this.fillEmailAndSubmit = async (email, loginTimeout) => {
118606
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
118598
118607
  await this.page.getByTestId(LOGIN_SELECTORS.emailTextField).fill(email);
118599
118608
  const unregisteredEmailError = this.page.getByTestId(SIGNUP_SELECTORS.unregisteredEmailError);
118600
118609
  await test.expect(async () => {
@@ -118605,19 +118614,15 @@ class OrganizationPage {
118605
118614
  };
118606
118615
  this.loginViaSSO = async (email = generateRandomBypassEmail(), loginTimeout = 2 * 60 * 1000) => {
118607
118616
  await this.fillEmailAndSubmit(email, loginTimeout);
118608
- await this.page
118609
- .getByTestId(SIGNUP_SELECTORS.otpTextBox)
118610
- .fill(faker.faker.string.numeric(6));
118617
+ await this.fillOTP();
118611
118618
  };
118612
118619
  this.loginWithFastmailEmail = async ({ email, loginTimeout = 2 * 60 * 1000, fetchOtpFromEmail, }) => {
118613
118620
  await this.fillEmailAndSubmit(email, loginTimeout);
118614
- const otp = await fetchOtpFromEmail({
118615
- email,
118616
- timeout: 4 * 60 * 1000,
118617
- });
118618
- await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(otp);
118621
+ const otp = await fetchOtpFromEmail({ email, timeout: 4 * 60 * 1000 });
118622
+ await this.fillOTP(otp);
118619
118623
  };
118620
118624
  this.setupProfile = async ({ firstName = faker.faker.person.firstName(), lastName = faker.faker.person.lastName(), country, } = {}) => {
118625
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
118621
118626
  await this.page
118622
118627
  .getByTestId(SIGNUP_SELECTORS.firstNameTextField)
118623
118628
  .fill(firstName);
@@ -118647,19 +118652,14 @@ class OrganizationPage {
118647
118652
  this.signUp = async ({ credentials, fetchOtpFromEmail, appName, }) => {
118648
118653
  let otp = "123456";
118649
118654
  await this.page.goto(`${ROUTES.neetoAuthSignup}?redirect_uri=${credentials.domain}`, { timeout: 20000 });
118650
- await this.page
118651
- .getByTestId(SIGNUP_SELECTORS.emailTextField)
118652
- .fill(credentials.email);
118653
- const submitButton = this.page.getByTestId(SIGNUP_SELECTORS.submitButton);
118654
- await submitButton.click();
118655
- await test.expect(submitButton).toBeHidden({ timeout: 10000 });
118655
+ await this.submitEmail(credentials.email);
118656
118656
  if (fetchOtpFromEmail !== undefined) {
118657
118657
  otp = await fetchOtpFromEmail({
118658
118658
  email: credentials.email,
118659
118659
  timeout: 4 * 60 * 1000,
118660
118660
  });
118661
118661
  }
118662
- await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(otp);
118662
+ await this.fillOTP(otp);
118663
118663
  await this.fillOrganizationDetails({
118664
118664
  credentials,
118665
118665
  appName,
@@ -118671,6 +118671,7 @@ class OrganizationPage {
118671
118671
  this.fillOrganizationDetails = async ({ credentials, appName, }) => {
118672
118672
  const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
118673
118673
  const organizationSubmitButton = this.page.getByTestId(SIGNUP_SELECTORS.organizationSubmitButton);
118674
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
118674
118675
  await this.page
118675
118676
  .getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
118676
118677
  .fill(neetoCist.humanize(credentials.businessName));
@@ -118679,10 +118680,7 @@ class OrganizationPage {
118679
118680
  .fill(credentials.subdomainName);
118680
118681
  const subdomainErrorCount = await subdomainError.count();
118681
118682
  subdomainErrorCount !== 0 && (await this.updateSubdomainIfExists(appName));
118682
- //TODO: Use getByTestId when this issue https://github.com/bigbinary/neeto-auth-web/issues/6460 is resolved
118683
- await test.expect(this.page.getByTitle(ORGANIZATION_TEXTS.subdomainAvailable)).toBeVisible({
118684
- timeout: 45000,
118685
- });
118683
+ await test.expect(this.page.getByTestId(SIGNUP_SELECTORS.subdomainAvailabilityMsg)).toBeVisible({ timeout: 45000 });
118686
118684
  await organizationSubmitButton.click();
118687
118685
  await Promise.all([
118688
118686
  test.expect(organizationSubmitButton).toBeHidden({ timeout: 45 * 1000 }),