@bigbinary/neeto-playwright-commons 1.8.45 → 1.8.47

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
@@ -250,6 +250,7 @@ const COMMON_SELECTORS = {
250
250
  header: "neeto-molecules-header",
251
251
  sidebarSubLink: (label) => `${hyphenize(label)}-sub-link`,
252
252
  sidebarGoBackButton: (label) => `${hyphenize(label)}-go-back-button`,
253
+ selectSingleValue: "select-single-value",
253
254
  };
254
255
 
255
256
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -12424,7 +12425,7 @@ class EmbedBase {
12424
12425
  await test$1.expect(popUpButton).toBeVisible();
12425
12426
  await popUpButton.click();
12426
12427
  await test$1.expect(this.embedTestPage.locator(EMBED_SELECTORS.loader(this.appName))).toBeHidden({
12427
- timeout: 10000,
12428
+ timeout: 40000,
12428
12429
  });
12429
12430
  };
12430
12431
  this.copyEmbedScript = async ({ embedLabel }) => {
@@ -12568,6 +12569,7 @@ const ROUTES = {
12568
12569
  neetoAuth: NEETO_AUTH_BASE_URL(),
12569
12570
  loginLink: "/login",
12570
12571
  profile: "/profile",
12572
+ admin: "/admin",
12571
12573
  myProfile: "/my/profile",
12572
12574
  authSettings: "/settings",
12573
12575
  webhooks: "/webhooks",
@@ -13492,6 +13494,18 @@ class ZapierPage extends IntegrationBase {
13492
13494
  }
13493
13495
  }
13494
13496
 
13497
+ const LOGIN_SELECTORS = {
13498
+ appleAuthenticationButton: "apple-authentication-button",
13499
+ emailTextField: "login-email-text-field",
13500
+ googleAuthenticationButton: "google-authentication-button",
13501
+ githubAuthenticationButton: "github-authentication-button",
13502
+ loginViaEmailButton: "login-via-email-button",
13503
+ passwordTextField: "login-password-text-field",
13504
+ rememberMeCheckBox: "login-remember-me-check-box",
13505
+ submitButton: "login-submit-button",
13506
+ twitterAuthenticationButton: "twitter-authentication-button",
13507
+ };
13508
+
13495
13509
  const SIGNUP_SELECTORS = {
13496
13510
  emailTextField: "signup-email-text-field",
13497
13511
  firstNameTextField: "signup-profile-first-name-text-field",
@@ -13508,6 +13522,29 @@ const SIGNUP_SELECTORS = {
13508
13522
  unregisterdEmailError: "unregisterd-email-error",
13509
13523
  };
13510
13524
 
13525
+ const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, loginPath = "/", }) => {
13526
+ if (shouldSkipSetupAndTeardown())
13527
+ return;
13528
+ await page.goto(loginPath);
13529
+ await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
13530
+ await page
13531
+ .getByTestId("login-password-text-field")
13532
+ .fill(CREDENTIALS.password);
13533
+ const login = neetoPlaywrightUtilities.interceptMultipleResponses({
13534
+ times: 1,
13535
+ });
13536
+ await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
13537
+ await login;
13538
+ const userCredentials = readFileSyncIfExists();
13539
+ await page.context().storageState({ path: STORAGE_STATE });
13540
+ const mergedCredentials = ramda.mergeAll([readFileSyncIfExists(), userCredentials]);
13541
+ writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
13542
+ updateCredentials({ key: "isLoggedIn", value: "true" });
13543
+ };
13544
+ const login = async ({ page, neetoPlaywrightUtilities, loginPath, }) => !IS_STAGING_ENV &&
13545
+ (await loginWithoutSSO({ page, neetoPlaywrightUtilities, loginPath }));
13546
+ const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.faker.number.int()}@bigbinary.com`;
13547
+
13511
13548
  const extractSubdomainFromError = (errorString) => {
13512
13549
  const regex = /cpt[a-zA-Z0-9-]+/g;
13513
13550
  const matches = errorString.match(regex);
@@ -13540,47 +13577,18 @@ class OrganizationPage {
13540
13577
  await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
13541
13578
  await signup;
13542
13579
  await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(defaultOtp);
13543
- await this.page
13544
- .getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
13545
- .fill(businessName);
13546
- const fetchSubdomainAvailability = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13547
- responseUrl: ROUTES.subdomainAvailability,
13548
- timeout: 60 * 1000,
13549
- baseUrl: NEETO_AUTH_BASE_URL(),
13550
- });
13551
- await this.page
13552
- .getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
13553
- .fill(subdomainName);
13554
- await fetchSubdomainAvailability;
13555
- const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
13556
- const subdomainErrorCount = await subdomainError.count();
13557
- if (subdomainErrorCount !== 0) {
13558
- await this.updateSubdomainIfExists(appNameInLowerCase);
13559
- }
13560
- const fetchProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13561
- times: 2,
13562
- timeout: 60 * 1000,
13563
- baseUrl: NEETO_AUTH_BASE_URL(),
13564
- });
13565
- await this.page
13566
- .getByTestId(SIGNUP_SELECTORS.organizationSubmitButton)
13567
- .click();
13568
- await fetchProfile;
13569
- await this.page.waitForURL(`**${ROUTES.profile}`, { timeout: 60 * 1000 });
13570
- await this.page
13571
- .getByTestId(SIGNUP_SELECTORS.firstNameTextField)
13572
- .fill(firstName);
13573
- await this.page
13574
- .getByTestId(SIGNUP_SELECTORS.lastNameTextField)
13575
- .fill(lastName);
13576
- await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
13577
- const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13578
- responseUrl: ROUTES.signup,
13579
- timeout: 1000 * 60,
13580
- baseUrl: NEETO_AUTH_BASE_URL(),
13580
+ await this.fillOrganizationDetails({
13581
+ credentials: {
13582
+ firstName,
13583
+ lastName,
13584
+ email,
13585
+ currentUserName: email,
13586
+ businessName,
13587
+ subdomainName,
13588
+ domain: appNameInLowerCase,
13589
+ },
13590
+ appName: appNameInLowerCase,
13581
13591
  });
13582
- await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
13583
- await submitProfile;
13584
13592
  await this.page.waitForURL(new RegExp(getGlobalUserState().domain), {
13585
13593
  waitUntil: "load",
13586
13594
  });
@@ -13649,6 +13657,106 @@ class OrganizationPage {
13649
13657
  }
13650
13658
  }
13651
13659
  };
13660
+ this.loginViaSSO = async (email = generateRandomBypassEmail()) => {
13661
+ await this.page.getByTestId(LOGIN_SELECTORS.emailTextField).fill(email);
13662
+ await test$1.expect(async () => {
13663
+ await this.page.getByTestId(LOGIN_SELECTORS.submitButton).click();
13664
+ await test$1.expect(this.page.getByTestId(SIGNUP_SELECTORS.unregisterdEmailError)).toBeHidden();
13665
+ }).toPass({ timeout: 15000 });
13666
+ await this.page
13667
+ .getByTestId(SIGNUP_SELECTORS.otpTextBox)
13668
+ .fill(faker.faker.string.numeric(6));
13669
+ };
13670
+ this.setupProfile = async ({ firstName = faker.faker.person.firstName(), lastName = faker.faker.person.lastName(), } = {}) => {
13671
+ await this.page
13672
+ .getByTestId(SIGNUP_SELECTORS.firstNameTextField)
13673
+ .fill(firstName);
13674
+ await this.page
13675
+ .getByTestId(SIGNUP_SELECTORS.lastNameTextField)
13676
+ .fill(lastName);
13677
+ await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
13678
+ const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13679
+ customPageContext: this.page,
13680
+ responseUrl: ROUTES.signup,
13681
+ baseUrl: NEETO_AUTH_BASE_URL(),
13682
+ timeout: 60000,
13683
+ });
13684
+ await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
13685
+ await submitProfile;
13686
+ await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden();
13687
+ };
13688
+ this.loginAndOnboard = async ({ email, firstName, lastName, handleOnboarding, }) => {
13689
+ await this.page.goto(ROUTES.admin);
13690
+ await this.loginViaSSO(email);
13691
+ await this.setupProfile({ firstName, lastName });
13692
+ await this.page.waitForURL(new RegExp(getGlobalUserState().domain), {
13693
+ waitUntil: "load",
13694
+ });
13695
+ await handleOnboarding();
13696
+ };
13697
+ this.signUp = async ({ credentials, fetchOtpFromEmail, appName, }) => {
13698
+ let otp = "123456";
13699
+ await this.page.goto(`${ROUTES.neetoAuthSignup}?redirect_uri=${credentials.domain}`);
13700
+ await this.page
13701
+ .getByTestId(SIGNUP_SELECTORS.emailTextField)
13702
+ .fill(credentials.email);
13703
+ const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13704
+ responseUrl: ROUTES.signup,
13705
+ timeout: 60 * 1000,
13706
+ baseUrl: NEETO_AUTH_BASE_URL(),
13707
+ });
13708
+ await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
13709
+ await signup;
13710
+ if (fetchOtpFromEmail !== undefined) {
13711
+ otp = await fetchOtpFromEmail({
13712
+ email: credentials.email,
13713
+ timeout: 4 * 60 * 1000,
13714
+ });
13715
+ }
13716
+ await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(otp);
13717
+ await this.fillOrganizationDetails({
13718
+ credentials,
13719
+ appName,
13720
+ });
13721
+ await this.page.waitForURL(new RegExp(credentials.domain));
13722
+ const STORAGE_STATE = await this.page.context().storageState();
13723
+ return { STORAGE_STATE, baseURL: process.env.BASE_URL };
13724
+ };
13725
+ this.fillOrganizationDetails = async ({ credentials, appName, }) => {
13726
+ await this.page
13727
+ .getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
13728
+ .fill(credentials.businessName);
13729
+ const fetchSubdomainAvailability = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13730
+ responseUrl: ROUTES.subdomainAvailability,
13731
+ timeout: 60 * 1000,
13732
+ baseUrl: NEETO_AUTH_BASE_URL(),
13733
+ });
13734
+ await this.page
13735
+ .getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
13736
+ .fill(credentials.subdomainName);
13737
+ await fetchSubdomainAvailability;
13738
+ const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
13739
+ const subdomainErrorCount = await subdomainError.count();
13740
+ if (subdomainErrorCount !== 0) {
13741
+ await this.updateSubdomainIfExists(appName);
13742
+ }
13743
+ const fetchProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
13744
+ times: 2,
13745
+ timeout: 60 * 1000,
13746
+ baseUrl: NEETO_AUTH_BASE_URL(),
13747
+ });
13748
+ await this.page
13749
+ .getByTestId(SIGNUP_SELECTORS.organizationSubmitButton)
13750
+ .click();
13751
+ await fetchProfile;
13752
+ await this.page.waitForURL(`**${ROUTES.profile}`, {
13753
+ timeout: 60 * 1000,
13754
+ });
13755
+ await this.setupProfile({
13756
+ firstName: credentials.firstName,
13757
+ lastName: credentials.lastName,
13758
+ });
13759
+ };
13652
13760
  this.page = page;
13653
13761
  this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
13654
13762
  }
@@ -13732,18 +13840,6 @@ const NEETO_FILTERS_SELECTORS = {
13732
13840
  paneModalCrossIcon: "neeto-filters-close-button",
13733
13841
  };
13734
13842
 
13735
- const LOGIN_SELECTORS = {
13736
- appleAuthenticationButton: "apple-authentication-button",
13737
- emailTextField: "login-email-text-field",
13738
- googleAuthenticationButton: "google-authentication-button",
13739
- githubAuthenticationButton: "github-authentication-button",
13740
- loginViaEmailButton: "login-via-email-button",
13741
- passwordTextField: "login-password-text-field",
13742
- rememberMeCheckBox: "login-remember-me-check-box",
13743
- submitButton: "login-submit-button",
13744
- twitterAuthenticationButton: "twitter-authentication-button",
13745
- };
13746
-
13747
13843
  const MEMBER_SELECTORS = {
13748
13844
  membersTab: "members-nav-tab",
13749
13845
  newButton: "ntm-add-member-button",
@@ -13847,29 +13943,6 @@ const initializeCredentials = (product) => {
13847
13943
  }
13848
13944
  };
13849
13945
 
13850
- const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, loginPath = "/", }) => {
13851
- if (shouldSkipSetupAndTeardown())
13852
- return;
13853
- await page.goto(loginPath);
13854
- await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
13855
- await page
13856
- .getByTestId("login-password-text-field")
13857
- .fill(CREDENTIALS.password);
13858
- const login = neetoPlaywrightUtilities.interceptMultipleResponses({
13859
- times: 1,
13860
- });
13861
- await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
13862
- await login;
13863
- const userCredentials = readFileSyncIfExists();
13864
- await page.context().storageState({ path: STORAGE_STATE });
13865
- const mergedCredentials = ramda.mergeAll([readFileSyncIfExists(), userCredentials]);
13866
- writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
13867
- updateCredentials({ key: "isLoggedIn", value: "true" });
13868
- };
13869
- const login = async ({ page, neetoPlaywrightUtilities, loginPath, }) => !IS_STAGING_ENV &&
13870
- (await loginWithoutSSO({ page, neetoPlaywrightUtilities, loginPath }));
13871
- const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.faker.number.int()}@bigbinary.com`;
13872
-
13873
13946
  const addMemberViaRequest = ({ email, role = MEMBER_TEXTS.agent, appName, neetoPlaywrightUtilities, }) => neetoPlaywrightUtilities.apiRequest({
13874
13947
  method: "post",
13875
13948
  url: API_ROUTES.teamMembers.index,
@@ -146838,6 +146911,14 @@ const executeWithThrottledResources = async ({ code: emulatedCode, kind = "both"
146838
146911
  await cpuThrottlingUsingCDP({ cdpSession, rate: 1 });
146839
146912
  };
146840
146913
 
146914
+ const openFilterPane = async (page) => {
146915
+ await page.getByTestId(NEETO_FILTERS_SELECTORS.filterButton).click();
146916
+ await test$1.expect(page.getByTestId(COMMON_SELECTORS.paneHeader)).toHaveText(playwrightI18nextFixture.getI18nInstance().t("neetoFilters.common.filters"));
146917
+ };
146918
+ const filterUtils = {
146919
+ openFilterPane,
146920
+ };
146921
+
146841
146922
  var main$2 = {exports: {}};
146842
146923
 
146843
146924
  var name = "dotenv";
@@ -147497,6 +147578,7 @@ exports.decodeQRCodeFromFile = decodeQRCodeFromFile;
147497
147578
  exports.definePlaywrightConfig = definePlaywrightConfig;
147498
147579
  exports.executeWithThrottledResources = executeWithThrottledResources;
147499
147580
  exports.extractSubdomainFromError = extractSubdomainFromError;
147581
+ exports.filterUtils = filterUtils;
147500
147582
  exports.generateRandomBypassEmail = generateRandomBypassEmail;
147501
147583
  exports.generateStagingData = generateStagingData;
147502
147584
  exports.getByDataQA = getByDataQA;