@bigbinary/neeto-playwright-commons 4.8.9 → 4.8.10

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.
Files changed (3) hide show
  1. package/index.d.ts +220 -53
  2. package/index.js +142 -73
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -5387,6 +5387,36 @@ declare class TeamMembersV2 extends TeamMembers {
5387
5387
  } | undefined;
5388
5388
  }) => Promise<void>;
5389
5389
  }
5390
+ /**
5391
+ *
5392
+ * Function to generate a random email to bypass OTP verification and log into
5393
+ *
5394
+ * neeto products.
5395
+ *
5396
+ * @example
5397
+ *
5398
+ * import { generateRandomBypassEmail } from "@neetoplaywright";
5399
+ *
5400
+ * const bypassEmail = generateRandomBypassEmail();
5401
+ * @endexample
5402
+ */
5403
+ declare const generateRandomBypassEmail: () => string;
5404
+ declare const LOGIN_STRATEGIES: {
5405
+ readonly password: "password";
5406
+ readonly oliver: "oliver";
5407
+ readonly bypassOtp: "bypassOtp";
5408
+ readonly emailOtp: "emailOtp";
5409
+ readonly authenticatorApp: "authenticatorApp";
5410
+ readonly google: "google";
5411
+ };
5412
+ type LoginStrategy = ValueOf<typeof LOGIN_STRATEGIES>;
5413
+ declare const LOGIN_TIMEOUT: number;
5414
+ declare const OTP_FETCH_TIMEOUT: number;
5415
+ interface LoginDefaults {
5416
+ via: Exclude<LoginStrategy, "emailOtp">;
5417
+ generateEmail: () => string;
5418
+ }
5419
+ declare const LOGIN_DEFAULTS: LoginDefaults;
5390
5420
  interface BasicUserInfo {
5391
5421
  firstName: string;
5392
5422
  lastName: string;
@@ -5413,6 +5443,43 @@ interface LoginWithFastmailEmail {
5413
5443
  loginTimeout?: number;
5414
5444
  fetchOtpFromEmail: FetchOtpFromEmail;
5415
5445
  }
5446
+ interface ProfileDetails {
5447
+ firstName?: string;
5448
+ lastName?: string;
5449
+ country?: string;
5450
+ }
5451
+ interface LoginBase {
5452
+ email?: string;
5453
+ path?: string;
5454
+ }
5455
+ type LoginParams = LoginBase & ({
5456
+ via?: Exclude<LoginStrategy, "emailOtp">;
5457
+ fetchOtpFromEmail?: never;
5458
+ } | {
5459
+ via: "emailOtp";
5460
+ fetchOtpFromEmail: FetchOtpFromEmail;
5461
+ });
5462
+ interface EmailStrategyParams {
5463
+ email: string;
5464
+ }
5465
+ interface EmailOtpStrategyParams extends EmailStrategyParams {
5466
+ fetchOtpFromEmail: FetchOtpFromEmail;
5467
+ }
5468
+ type LoginStrategyArgs = {
5469
+ oliver: [];
5470
+ google: [];
5471
+ password: [EmailStrategyParams];
5472
+ bypassOtp: [EmailStrategyParams];
5473
+ authenticatorApp: [EmailStrategyParams];
5474
+ emailOtp: [EmailOtpStrategyParams];
5475
+ };
5476
+ type LoginStrategyHandlers = { [K in LoginStrategy]: (...args: LoginStrategyArgs[K]) => Promise<void> };
5477
+ interface SignUpParams {
5478
+ credentials: Credentials;
5479
+ fetchOtpFromEmail?: FetchOtpFromEmail;
5480
+ appName: string;
5481
+ shouldSignupViaApi?: boolean;
5482
+ }
5416
5483
  interface Credentials extends BasicUserInfo {
5417
5484
  otp?: number;
5418
5485
  domain: string;
@@ -5451,6 +5518,10 @@ declare class OrganizationPage {
5451
5518
  */
5452
5519
  submitEmail: (email: string) => Promise<void>;
5453
5520
  private dismissAuthenticatorSetupPromptIfPresent;
5521
+ loginAsOliver: () => Promise<void>;
5522
+ fillCredentials: (email: string) => Promise<void>;
5523
+ private createOrganizationInDev;
5524
+ private createOrganizationInStaging;
5454
5525
  /**
5455
5526
  *
5456
5527
  * Used to create a new organization. It takes the following parameters:
@@ -5479,15 +5550,7 @@ declare class OrganizationPage {
5479
5550
  * })
5480
5551
  * @endexample
5481
5552
  */
5482
- createOrganization: ({
5483
- email,
5484
- businessName,
5485
- subdomainName,
5486
- firstName,
5487
- lastName,
5488
- appName,
5489
- shouldSignupViaApi
5490
- }: CreateOrganizationProps$1) => Promise<void>;
5553
+ createOrganization: (params: CreateOrganizationProps$1) => Promise<void>;
5491
5554
  /**
5492
5555
  *
5493
5556
  * Used to set up an Organization. Works only with staging env. It takes the following parameters:
@@ -5516,16 +5579,82 @@ declare class OrganizationPage {
5516
5579
  * @endexample
5517
5580
  */
5518
5581
  updateSubdomainIfExists: (appName: string) => Promise<void>;
5519
- fillEmailAndSubmit: (email: string, loginTimeout: number) => Promise<void>;
5582
+ fillEmailAndSubmit: (email: string, loginTimeout?: number) => Promise<void>;
5520
5583
  private enterTotpCode;
5584
+ loginStrategies: LoginStrategyHandlers;
5585
+ private runLoginStrategy;
5586
+ /**
5587
+ *
5588
+ * Logs a user in and stops there. It navigates when given a path, dispatches to
5589
+ *
5590
+ * the strategy the environment (or the caller) selected, and dismisses the
5591
+ *
5592
+ * authenticator-app prompt if it appears. Profile setup, onboarding and session
5593
+ *
5594
+ * persistence are separate concerns that stay with the caller — loginAndOnboard
5595
+ *
5596
+ * and the setup helpers keep handling those flows.
5597
+ *
5598
+ * email (optional): Defaults to the address that suits the current environment — the seeded credentials in development, a generated bypass address elsewhere.
5599
+ *
5600
+ * via (optional): Which strategy proves the user's identity. Defaults to password in development and bypassOtp in staging and review.
5601
+ *
5602
+ * path (optional): Navigated to before authenticating. Skipped when omitted.
5603
+ *
5604
+ * fetchOtpFromEmail: Required when — and only when — via is emailOtp. Receives { email, timeout } and returns the code. That timeout is a fixed 4 minutes. Email submission retries use the shared LOGIN_TIMEOUT of 2 minutes.
5605
+ *
5606
+ * The available strategies are password and oliver (development seed data),
5607
+ *
5608
+ * bypassOtp (staging and review, where any six digits are accepted),
5609
+ *
5610
+ * emailOtp (the real code, read from a mailbox), authenticatorApp (a TOTP
5611
+ *
5612
+ * token, used by the production health checks) and google (OAuth).
5613
+ *
5614
+ * @example
5615
+ *
5616
+ * // Whatever the current environment calls for
5617
+ * await organizationPage.login()
5618
+ *
5619
+ * // A specific user, after navigating
5620
+ * await organizationPage.login({ email, path: ROUTES.admin })
5621
+ *
5622
+ * // A real code from the mailbox
5623
+ * await organizationPage.login({
5624
+ * email,
5625
+ * via: "emailOtp",
5626
+ * fetchOtpFromEmail: ({ email, timeout }) =>
5627
+ * mailerUtils.findOtpFromEmail({ email, timeout }),
5628
+ * })
5629
+ *
5630
+ * // Production health checks
5631
+ * await organizationPage.login({ email, via: "authenticatorApp" })
5632
+ * @endexample
5633
+ */
5634
+ login: (params?: LoginParams) => Promise<void>;
5635
+ /** @deprecated Use `login({ email, via: "authenticatorApp" })`. */
5636
+ /**
5637
+ *
5638
+ * Deprecated. Use login({ email, via: "authenticatorApp" }) instead. The loginTimeout argument is ignored.
5639
+ *
5640
+ * Logs in by generating a TOTP token from PLAYWRIGHT_PRODUCTION_2FA_SECRET_KEY.
5641
+ *
5642
+ * Used by the production health checks.
5643
+ *
5644
+ * @example
5645
+ *
5646
+ * await organizationPage.loginViaAuthenticatorApp(email)
5647
+ * @endexample
5648
+ */
5521
5649
  loginViaAuthenticatorApp: (email?: string, loginTimeout?: number) => Promise<void>;
5650
+ /** @deprecated Use `login({ email })`. */
5522
5651
  /**
5523
5652
  *
5524
- * Used to login via SSO. It takes the following parameters:
5653
+ * Deprecated. Use login({ email }) instead. The loginTimeout argument is ignored; email submission retries use the shared LOGIN_TIMEOUT.
5525
5654
  *
5526
5655
  * email (optional): A bypass email. If not provided, a random bypass email will be generated.
5527
5656
  *
5528
- * loginTimeout (optional): Specifies the maximum amount of time the method will wait for the login process to complete before timing out. Default is 15s.
5657
+ * loginTimeout (optional): Ignored; email submission retries use the shared LOGIN_TIMEOUT.
5529
5658
  *
5530
5659
  * @example
5531
5660
  *
@@ -5533,13 +5662,16 @@ declare class OrganizationPage {
5533
5662
  * @endexample
5534
5663
  */
5535
5664
  loginViaSSO: (email?: string, loginTimeout?: number) => Promise<void>;
5665
+ /** @deprecated Use `login({ email, via: "emailOtp", fetchOtpFromEmail })`. */
5536
5666
  /**
5667
+ *
5668
+ * Deprecated. Use login({ email, via: "emailOtp", fetchOtpFromEmail }) instead.
5537
5669
  *
5538
5670
  * This method is used to login NeetoAuth using Fastmail email id. It takes the following parameters:
5539
5671
  *
5540
5672
  * email: A Fastmail email id. You can generate a Fastmail email id using the method generateRandomEmail in MailerUtils.
5541
5673
  *
5542
- * loginTimeout (optional): Specifies the maximum amount of time the method will wait for the login process to complete before timing out. Default is 15s.
5674
+ * loginTimeout (optional): Ignored; email submission retries use the shared LOGIN_TIMEOUT.
5543
5675
  *
5544
5676
  * fetchOtpFromEmail: Method to fetch OTP from Fastmail email.
5545
5677
  *
@@ -5557,7 +5689,6 @@ declare class OrganizationPage {
5557
5689
  */
5558
5690
  loginWithFastmailEmail: ({
5559
5691
  email,
5560
- loginTimeout,
5561
5692
  fetchOtpFromEmail
5562
5693
  }: LoginWithFastmailEmail) => Promise<void>;
5563
5694
  /**
@@ -5580,14 +5711,14 @@ declare class OrganizationPage {
5580
5711
  firstName,
5581
5712
  lastName,
5582
5713
  country
5583
- }?: {
5584
- firstName?: string;
5585
- lastName?: string;
5586
- country?: string;
5587
- }) => Promise<void>;
5714
+ }?: ProfileDetails) => Promise<void>;
5588
5715
  /**
5589
5716
  *
5590
- * Used to login and onboard the user to app. It takes the following parameters:
5717
+ * Used to login and onboard the user to app. It delegates to login, so the
5718
+ *
5719
+ * strategy follows the same environment defaults documented there. It takes the
5720
+ *
5721
+ * following parameters:
5591
5722
  *
5592
5723
  * email: User email.
5593
5724
  *
@@ -5595,7 +5726,13 @@ declare class OrganizationPage {
5595
5726
  *
5596
5727
  * lastName: User last name.
5597
5728
  *
5598
- * handleOnBoard: Method to call after onboarding.
5729
+ * country (optional): Selected during profile setup.
5730
+ *
5731
+ * handleOnboarding: Method to call after onboarding.
5732
+ *
5733
+ * baseURL (optional): Defaults to process.env.BASE_URL. The admin path on this host is navigated to before logging in.
5734
+ *
5735
+ * fetchOtpFromEmail (optional): Supply it to log in with via: "emailOtp". Omit it to use the environment's default strategy.
5599
5736
  *
5600
5737
  * @example
5601
5738
  *
@@ -5616,6 +5753,8 @@ declare class OrganizationPage {
5616
5753
  baseURL,
5617
5754
  fetchOtpFromEmail
5618
5755
  }: LoginAndOnboardParams) => Promise<void>;
5756
+ private signUpInDev;
5757
+ private signUpInStaging;
5619
5758
  /**
5620
5759
  *
5621
5760
  * Used to signUp the user. It takes the following parameters:
@@ -5643,17 +5782,7 @@ declare class OrganizationPage {
5643
5782
  * })
5644
5783
  * @endexample
5645
5784
  */
5646
- signUp: ({
5647
- credentials,
5648
- fetchOtpFromEmail,
5649
- appName,
5650
- shouldSignupViaApi
5651
- }: {
5652
- credentials: Credentials;
5653
- fetchOtpFromEmail?: FetchOtpFromEmail;
5654
- appName: string;
5655
- shouldSignupViaApi?: boolean;
5656
- }) => Promise<{
5785
+ signUp: (params: SignUpParams) => Promise<{
5657
5786
  STORAGE_STATE: {
5658
5787
  cookies: Array<{
5659
5788
  name: string;
@@ -5703,7 +5832,10 @@ declare class OrganizationPage {
5703
5832
  appName: string;
5704
5833
  }) => Promise<void>;
5705
5834
  changeCountry: (country: string) => Promise<void>;
5835
+ /** @deprecated Use `login({ via: "google" })`. */
5706
5836
  /**
5837
+ *
5838
+ * Deprecated. Use login({ via: "google" }) instead.
5707
5839
  *
5708
5840
  * Used to login via Google authentication. This method clicks the Google authentication button, selects the "neetoAutomation" account, and handles TOTP verification if required. It takes no parameters.
5709
5841
  *
@@ -5713,6 +5845,7 @@ declare class OrganizationPage {
5713
5845
  * @endexample
5714
5846
  */
5715
5847
  loginViaGoogleAuth: () => Promise<void>;
5848
+ completeGoogleAuth: () => Promise<void>;
5716
5849
  }
5717
5850
  interface ApiKeyDetails {
5718
5851
  label: string;
@@ -9602,44 +9735,78 @@ interface LoginProps {
9602
9735
  loginPath?: string;
9603
9736
  email?: string;
9604
9737
  }
9605
- declare const authenticateUser: ({
9606
- page,
9607
- loginPath,
9608
- email
9609
- }: LoginProps) => Promise<void>;
9610
9738
  /**
9611
9739
  *
9612
- * Used to Login to App. Only works in staging environment. It takes the following parameters:
9613
- *
9614
- * loginPath (optional): The path to which the user should be redirected for login. Default is /
9740
+ * Logs in with the development credentials, clicking the "Login as Oliver" seed
9615
9741
  *
9616
- * page: A page object
9742
+ * button when no email is given.
9617
9743
  *
9618
9744
  * @example
9619
9745
  *
9620
- * import { login } from "@neetoplaywright"
9746
+ * // Before
9747
+ * await authenticateUser({ page, email, loginPath });
9621
9748
  *
9622
- * await login({ page, loginPath:"/home" })
9749
+ * // After
9750
+ * await organizationPage.login({ email, path: loginPath });
9623
9751
  * @endexample
9624
9752
  */
9625
- declare const login: ({
9753
+ declare const authenticateUser: ({
9626
9754
  page,
9627
- loginPath
9628
- }: Omit<LoginProps, "email">) => Promise<void>;
9755
+ loginPath,
9756
+ email
9757
+ }: LoginProps) => Promise<void>;
9629
9758
  /**
9630
9759
  *
9631
- * Function to generate a random email to bypass OTP verification and log into
9760
+ * Logs a user in and stops there. It navigates when given a path, dispatches to
9632
9761
  *
9633
- * neeto products.
9762
+ * the strategy the environment (or the caller) selected, and dismisses the
9763
+ *
9764
+ * authenticator-app prompt if it appears. Profile setup, onboarding and session
9765
+ *
9766
+ * persistence are separate concerns that stay with the caller — loginAndOnboard
9767
+ *
9768
+ * and the setup helpers keep handling those flows.
9769
+ *
9770
+ * email (optional): Defaults to the address that suits the current environment — the seeded credentials in development, a generated bypass address elsewhere.
9771
+ *
9772
+ * via (optional): Which strategy proves the user's identity. Defaults to password in development and bypassOtp in staging and review.
9773
+ *
9774
+ * path (optional): Navigated to before authenticating. Skipped when omitted.
9775
+ *
9776
+ * fetchOtpFromEmail: Required when — and only when — via is emailOtp. Receives { email, timeout } and returns the code. That timeout is a fixed 4 minutes. Email submission retries use the shared LOGIN_TIMEOUT of 2 minutes.
9777
+ *
9778
+ * The available strategies are password and oliver (development seed data),
9779
+ *
9780
+ * bypassOtp (staging and review, where any six digits are accepted),
9781
+ *
9782
+ * emailOtp (the real code, read from a mailbox), authenticatorApp (a TOTP
9783
+ *
9784
+ * token, used by the production health checks) and google (OAuth).
9634
9785
  *
9635
9786
  * @example
9636
9787
  *
9637
- * import { generateRandomBypassEmail } from "@neetoplaywright";
9788
+ * // Whatever the current environment calls for
9789
+ * await organizationPage.login()
9638
9790
  *
9639
- * const bypassEmail = generateRandomBypassEmail();
9791
+ * // A specific user, after navigating
9792
+ * await organizationPage.login({ email, path: ROUTES.admin })
9793
+ *
9794
+ * // A real code from the mailbox
9795
+ * await organizationPage.login({
9796
+ * email,
9797
+ * via: "emailOtp",
9798
+ * fetchOtpFromEmail: ({ email, timeout }) =>
9799
+ * mailerUtils.findOtpFromEmail({ email, timeout }),
9800
+ * })
9801
+ *
9802
+ * // Production health checks
9803
+ * await organizationPage.login({ email, via: "authenticatorApp" })
9640
9804
  * @endexample
9641
9805
  */
9642
- declare const generateRandomBypassEmail: () => string;
9806
+ declare const login: ({
9807
+ page,
9808
+ loginPath
9809
+ }: Omit<LoginProps, "email">) => Promise<void>;
9643
9810
  /**
9644
9811
  *
9645
9812
  * Used to extract subdomain from the error message.
@@ -10562,5 +10729,5 @@ declare class InboundEmailApis {
10562
10729
  reply: (emailParams: ReplyInboundEmailParams) => Promise<playwright_core.APIResponse | undefined>;
10563
10730
  private deliverSource;
10564
10731
  }
10565
- export { ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_KEYS_SELECTORS, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, ApiKeysPageV2, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomCommandsV2, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, HelpAndProfilePageV2, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_MAILPIT_ENABLED, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_SHADCN_UI, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PRODUCT_ROLES_ROUTE_MAP, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, RolesPageV2, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, TeamMembersV2, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_TEST_EMAIL_V2, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getDirname, getFormattedPhoneNumber, getFullUrl, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, reviewAppBaseURL, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };
10566
- export type { BaseThemeStyle, BaseThemeStyleType, ColumnMenuAction, CountryProps, CustomFixture, EmailDeliveryConnectParams, EmailDeliveryProvider, EmailDeliveryVerifiedEmail, EmailDeliveryVerifyEmailParams, EmailDeliveryVerifyEmailResponse, EmailMatchCriteria, InboundEmailParams, IntroPageThemeStyle, IntroPageThemeStyleType, OAuthEmailDeliveryProvider, ProjectName, ReplyInboundEmailParams, Sms, SmsFilters, SmsProvider, SmsSearchCriteria, SmsSearchParams, ThemeCategory, ValueOf, WaitForSmsOptions };
10732
+ export { ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_KEYS_SELECTORS, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, ApiKeysPageV2, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomCommandsV2, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, HelpAndProfilePageV2, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_MAILPIT_ENABLED, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_SHADCN_UI, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_DEFAULTS, LOGIN_SELECTORS, LOGIN_STRATEGIES, LOGIN_TIMEOUT, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OTP_FETCH_TIMEOUT, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PRODUCT_ROLES_ROUTE_MAP, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, RolesPageV2, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, TeamMembersV2, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_TEST_EMAIL_V2, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getDirname, getFormattedPhoneNumber, getFullUrl, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, reviewAppBaseURL, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, _default as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };
10733
+ export type { BaseThemeStyle, BaseThemeStyleType, ColumnMenuAction, CountryProps, CustomFixture, EmailDeliveryConnectParams, EmailDeliveryProvider, EmailDeliveryVerifiedEmail, EmailDeliveryVerifyEmailParams, EmailDeliveryVerifyEmailResponse, EmailMatchCriteria, InboundEmailParams, IntroPageThemeStyle, IntroPageThemeStyleType, LoginStrategy, OAuthEmailDeliveryProvider, ProjectName, ReplyInboundEmailParams, Sms, SmsFilters, SmsProvider, SmsSearchCriteria, SmsSearchParams, ThemeCategory, ValueOf, WaitForSmsOptions };
package/index.js CHANGED
@@ -2638,6 +2638,34 @@ class CustomCommandsV2 extends CustomCommands {
2638
2638
  };
2639
2639
  }
2640
2640
 
2641
+ const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.number.int()}@bigbinary.com`;
2642
+ const LOGIN_STRATEGIES = {
2643
+ password: "password",
2644
+ oliver: "oliver",
2645
+ bypassOtp: "bypassOtp",
2646
+ emailOtp: "emailOtp",
2647
+ authenticatorApp: "authenticatorApp",
2648
+ google: "google",
2649
+ };
2650
+ const LOGIN_TIMEOUT = 2 * 60 * 1000;
2651
+ const OTP_FETCH_TIMEOUT = 4 * 60 * 1000;
2652
+ const DEFAULTS_BY_ENV = {
2653
+ [ENVIRONMENT.development]: {
2654
+ via: LOGIN_STRATEGIES.password,
2655
+ generateEmail: () => CREDENTIALS.email,
2656
+ },
2657
+ [ENVIRONMENT.staging]: {
2658
+ via: LOGIN_STRATEGIES.bypassOtp,
2659
+ generateEmail: generateRandomBypassEmail,
2660
+ },
2661
+ [ENVIRONMENT.review]: {
2662
+ via: LOGIN_STRATEGIES.bypassOtp,
2663
+ generateEmail: generateRandomBypassEmail,
2664
+ },
2665
+ };
2666
+ const LOGIN_DEFAULTS = DEFAULTS_BY_ENV[process.env.TEST_ENV ?? ""] ??
2667
+ DEFAULTS_BY_ENV[ENVIRONMENT.staging];
2668
+
2641
2669
  const CHAT_WIDGET_TEXTS = {
2642
2670
  newConversation: "Ask a question",
2643
2671
  welcomeChatBubble: "Hi! I'm here to assist you with any questions you may have. What can I do for you?",
@@ -17978,30 +18006,14 @@ class GooglePage extends IntegrationBase {
17978
18006
  };
17979
18007
  }
17980
18008
 
17981
- const loginAsOliver = async (page) => {
17982
- const loginAsOliverBtn = page.getByTestId(LOGIN_SELECTORS.loginAsOliverBtn);
17983
- await expect(loginAsOliverBtn).toBeVisible({ timeout: 30_000 });
17984
- await loginAsOliverBtn.click();
17985
- await expect(loginAsOliverBtn).toBeHidden({ timeout: 20_000 });
17986
- };
17987
- const fillCredentials = async (page, email) => {
17988
- const emailInput = page.getByTestId(LOGIN_SELECTORS.emailTextField);
17989
- await emailInput.waitFor({ state: "visible", timeout: 30_000 });
17990
- await emailInput.fill(email);
17991
- await page
17992
- .getByTestId(LOGIN_SELECTORS.passwordTextField)
17993
- .fill(CREDENTIALS.password);
17994
- const submitBtn = page.getByTestId(LOGIN_SELECTORS.submitButton);
17995
- await submitBtn.click();
17996
- await expect(submitBtn).toBeHidden({ timeout: 20_000 });
17997
- };
17998
18009
  const authenticateUser = async ({ page, loginPath, email, }) => {
17999
- loginPath && (await page.goto(loginPath, { timeout: 30_000 }));
18000
- await page.waitForLoadState("load", { timeout: 35_000 });
18001
- await expect(page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
18002
- timeout: 30_000,
18003
- });
18004
- !email ? await loginAsOliver(page) : await fillCredentials(page, email);
18010
+ const organizationPage = new OrganizationPage(page, new CustomCommands(page, page.request));
18011
+ await (email
18012
+ ? organizationPage.login({ email, path: loginPath })
18013
+ : organizationPage.login({
18014
+ via: LOGIN_STRATEGIES.oliver,
18015
+ path: loginPath,
18016
+ }));
18005
18017
  await expect(page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton)).toBeVisible({ timeout: 60_000 });
18006
18018
  };
18007
18019
  const login = async ({ page, loginPath = "/", }) => {
@@ -18014,7 +18026,6 @@ const login = async ({ page, loginPath = "/", }) => {
18014
18026
  writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
18015
18027
  updateCredentials({ key: "isLoggedIn", value: "true" });
18016
18028
  };
18017
- const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.number.int()}@bigbinary.com`;
18018
18029
 
18019
18030
  const extractSubdomainFromError = (errorString) => {
18020
18031
  const regex = /cpt[a-zA-Z0-9-]+/g;
@@ -18104,21 +18115,32 @@ class OrganizationPage {
18104
18115
  await expect(submitButton).toBeHidden({ timeout: 35_000 });
18105
18116
  };
18106
18117
  dismissAuthenticatorSetupPromptIfPresent = async () => {
18118
+ if (IS_DEV_ENV)
18119
+ return;
18107
18120
  const maybeLaterButton = this.page.getByTestId(LOGIN_SELECTORS.authenticatorAppLaterButton);
18108
18121
  (await maybeLaterButton.isVisible()) && (await maybeLaterButton.click());
18109
18122
  };
18110
- createOrganization = async ({ email, businessName, subdomainName, firstName, lastName, appName, shouldSignupViaApi = true, }) => {
18111
- if (shouldSkipSetupAndTeardown())
18112
- return;
18113
- if (IS_DEV_ENV) {
18114
- await createOrganizationViaRake({
18115
- email,
18116
- firstName,
18117
- lastName,
18118
- subdomainName,
18119
- });
18120
- return;
18121
- }
18123
+ loginAsOliver = async () => {
18124
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
18125
+ const loginAsOliverBtn = this.page.getByTestId(LOGIN_SELECTORS.loginAsOliverBtn);
18126
+ await expect(loginAsOliverBtn).toBeVisible({ timeout: 30_000 });
18127
+ await loginAsOliverBtn.click();
18128
+ await expect(loginAsOliverBtn).toBeHidden({ timeout: 20_000 });
18129
+ };
18130
+ fillCredentials = async (email) => {
18131
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
18132
+ const emailInput = this.page.getByTestId(LOGIN_SELECTORS.emailTextField);
18133
+ await emailInput.waitFor({ state: "visible", timeout: 30_000 });
18134
+ await emailInput.fill(email);
18135
+ await this.page
18136
+ .getByTestId(LOGIN_SELECTORS.passwordTextField)
18137
+ .fill(CREDENTIALS.password);
18138
+ const submitButton = this.page.getByTestId(LOGIN_SELECTORS.submitButton);
18139
+ await submitButton.click();
18140
+ await expect(submitButton).toBeHidden({ timeout: 20_000 });
18141
+ };
18142
+ createOrganizationInDev = ({ email, firstName, lastName, subdomainName, }) => createOrganizationViaRake({ email, firstName, lastName, subdomainName });
18143
+ createOrganizationInStaging = async ({ email, businessName, subdomainName, firstName, lastName, appName, shouldSignupViaApi = true, }) => {
18122
18144
  const appNameInLowerCase = appName.toLowerCase();
18123
18145
  const isNeetoAuth = appNameInLowerCase === "neetoauth";
18124
18146
  if (!shouldSignupViaApi) {
@@ -18157,6 +18179,13 @@ class OrganizationPage {
18157
18179
  waitUntil: "load",
18158
18180
  });
18159
18181
  };
18182
+ createOrganization = async (params) => {
18183
+ if (shouldSkipSetupAndTeardown())
18184
+ return;
18185
+ await (IS_DEV_ENV
18186
+ ? this.createOrganizationInDev(params)
18187
+ : this.createOrganizationInStaging(params));
18188
+ };
18160
18189
  setupOrganization = async (product, { shouldSignupViaApi } = {}) => {
18161
18190
  if (!IS_STAGING_ENV || shouldSkipSetupAndTeardown())
18162
18191
  return;
@@ -18216,7 +18245,7 @@ class OrganizationPage {
18216
18245
  }
18217
18246
  }
18218
18247
  };
18219
- fillEmailAndSubmit = async (email, loginTimeout) => {
18248
+ fillEmailAndSubmit = async (email, loginTimeout = LOGIN_TIMEOUT) => {
18220
18249
  await this.neetoPlaywrightUtilities.waitForPageLoad();
18221
18250
  await this.page.getByTestId(LOGIN_SELECTORS.emailTextField).fill(email);
18222
18251
  const unregisteredEmailError = this.page.getByTestId(SIGNUP_SELECTORS.unregisteredEmailError);
@@ -18252,28 +18281,61 @@ class OrganizationPage {
18252
18281
  expect(codeInput).toBeHidden({ timeout: 10_000 }),
18253
18282
  expect(this.page.getByTestId(LOGIN_SELECTORS.enterOtpInputError)).toBeHidden({ timeout: 10_000 }),
18254
18283
  ]);
18255
- }).toPass({ timeout: 2 * 60 * 1000 });
18284
+ }).toPass({ timeout: LOGIN_TIMEOUT });
18256
18285
  };
18257
- loginViaAuthenticatorApp = async (email = generateRandomBypassEmail(), loginTimeout = 2 * 60 * 1000) => {
18258
- await this.fillEmailAndSubmit(email, loginTimeout);
18259
- await this.neetoPlaywrightUtilities.waitForPageLoad();
18260
- await this.enterTotpCode();
18286
+ loginStrategies = {
18287
+ [LOGIN_STRATEGIES.oliver]: () => this.loginAsOliver(),
18288
+ [LOGIN_STRATEGIES.google]: () => this.completeGoogleAuth(),
18289
+ [LOGIN_STRATEGIES.password]: ({ email }) => this.fillCredentials(email),
18290
+ [LOGIN_STRATEGIES.bypassOtp]: async ({ email }) => {
18291
+ await this.fillEmailAndSubmit(email, LOGIN_TIMEOUT);
18292
+ await this.fillOTP();
18293
+ },
18294
+ [LOGIN_STRATEGIES.emailOtp]: async ({ email, fetchOtpFromEmail }) => {
18295
+ await this.fillEmailAndSubmit(email, LOGIN_TIMEOUT);
18296
+ await this.fillOTP(await fetchOtpFromEmail({ email, timeout: OTP_FETCH_TIMEOUT }));
18297
+ },
18298
+ [LOGIN_STRATEGIES.authenticatorApp]: async ({ email }) => {
18299
+ await this.fillEmailAndSubmit(email, LOGIN_TIMEOUT);
18300
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
18301
+ await this.enterTotpCode();
18302
+ },
18261
18303
  };
18262
- loginViaSSO = async (email = generateRandomBypassEmail(), loginTimeout = 2 * 60 * 1000) => {
18263
- if (IS_DEV_ENV) {
18264
- await authenticateUser({ page: this.page, email });
18265
- return;
18304
+ runLoginStrategy = (params, email) => {
18305
+ if (!params.via) {
18306
+ return this.runLoginStrategy({ via: LOGIN_DEFAULTS.via }, email);
18307
+ }
18308
+ switch (params.via) {
18309
+ case LOGIN_STRATEGIES.oliver:
18310
+ case LOGIN_STRATEGIES.google:
18311
+ return this.loginStrategies[params.via]();
18312
+ case LOGIN_STRATEGIES.password:
18313
+ case LOGIN_STRATEGIES.bypassOtp:
18314
+ case LOGIN_STRATEGIES.authenticatorApp:
18315
+ return this.loginStrategies[params.via]({ email });
18316
+ case LOGIN_STRATEGIES.emailOtp:
18317
+ return this.loginStrategies.emailOtp({
18318
+ email,
18319
+ fetchOtpFromEmail: params.fetchOtpFromEmail,
18320
+ });
18321
+ default: {
18322
+ const unexpected = params.via;
18323
+ return unexpected;
18324
+ }
18266
18325
  }
18267
- await this.fillEmailAndSubmit(email, loginTimeout);
18268
- await this.fillOTP();
18269
- await this.dismissAuthenticatorSetupPromptIfPresent();
18270
18326
  };
18271
- loginWithFastmailEmail = async ({ email, loginTimeout = 2 * 60 * 1000, fetchOtpFromEmail, }) => {
18272
- await this.fillEmailAndSubmit(email, loginTimeout);
18273
- const otp = await fetchOtpFromEmail({ email, timeout: 4 * 60 * 1000 });
18274
- await this.fillOTP(otp);
18327
+ login = async (params = {}) => {
18328
+ const { path, email = LOGIN_DEFAULTS.generateEmail() } = params;
18329
+ path && (await this.page.goto(path, { timeout: 30_000 }));
18330
+ await this.runLoginStrategy(params, email);
18275
18331
  await this.dismissAuthenticatorSetupPromptIfPresent();
18276
18332
  };
18333
+ /** @deprecated Use `login({ email, via: "authenticatorApp" })`. */
18334
+ loginViaAuthenticatorApp = email => this.login({ email, via: LOGIN_STRATEGIES.authenticatorApp });
18335
+ /** @deprecated Use `login({ email })`. */
18336
+ loginViaSSO = email => this.login({ email });
18337
+ /** @deprecated Use `login({ email, via: "emailOtp", fetchOtpFromEmail })`. */
18338
+ loginWithFastmailEmail = ({ email, fetchOtpFromEmail, }) => this.login({ email, via: LOGIN_STRATEGIES.emailOtp, fetchOtpFromEmail });
18277
18339
  setupProfile = async ({ firstName = faker.person.firstName(), lastName = faker.person.lastName(), country, } = {}) => {
18278
18340
  if (IS_DEV_ENV)
18279
18341
  return;
@@ -18303,9 +18365,9 @@ class OrganizationPage {
18303
18365
  }
18304
18366
  else {
18305
18367
  await this.page.goto(`${baseURL}${ROUTES.admin}`, { timeout: 20_000 });
18306
- fetchOtpFromEmail === undefined
18307
- ? await this.loginViaSSO(email)
18308
- : await this.loginWithFastmailEmail({ email, fetchOtpFromEmail });
18368
+ await this.login(fetchOtpFromEmail
18369
+ ? { email, via: LOGIN_STRATEGIES.emailOtp, fetchOtpFromEmail }
18370
+ : { email });
18309
18371
  await this.setupProfile({ firstName, lastName, country });
18310
18372
  await this.page.waitForURL(new RegExp(getGlobalUserState().domain), {
18311
18373
  waitUntil: "load",
@@ -18313,21 +18375,21 @@ class OrganizationPage {
18313
18375
  }
18314
18376
  await handleOnboarding();
18315
18377
  };
18316
- signUp = async ({ credentials, fetchOtpFromEmail, appName, shouldSignupViaApi = true, }) => {
18317
- if (IS_DEV_ENV) {
18318
- await createOrganizationViaRake({
18319
- email: credentials.email,
18320
- firstName: credentials.firstName,
18321
- lastName: credentials.lastName,
18322
- subdomainName: credentials.subdomainName,
18323
- });
18324
- await authenticateUser({
18325
- page: this.page,
18326
- email: credentials.email,
18327
- loginPath: `${baseURLGenerator(appName, credentials.subdomainName)}${ROUTES.admin}`,
18328
- });
18329
- }
18330
- else if (fetchOtpFromEmail !== undefined || !shouldSignupViaApi) {
18378
+ signUpInDev = async ({ credentials, appName }) => {
18379
+ await createOrganizationViaRake({
18380
+ email: credentials.email,
18381
+ firstName: credentials.firstName,
18382
+ lastName: credentials.lastName,
18383
+ subdomainName: credentials.subdomainName,
18384
+ });
18385
+ await authenticateUser({
18386
+ page: this.page,
18387
+ email: credentials.email,
18388
+ loginPath: `${baseURLGenerator(appName, credentials.subdomainName)}${ROUTES.admin}`,
18389
+ });
18390
+ };
18391
+ signUpInStaging = async ({ credentials, fetchOtpFromEmail, appName, shouldSignupViaApi = true, }) => {
18392
+ if (fetchOtpFromEmail !== undefined || !shouldSignupViaApi) {
18331
18393
  let otp = "123456";
18332
18394
  await this.page.goto(`${ROUTES.neetoAuthSignup}?redirect_uri=${credentials.domain}`, { timeout: 20_000 });
18333
18395
  await this.submitEmail(credentials.email);
@@ -18356,6 +18418,11 @@ class OrganizationPage {
18356
18418
  });
18357
18419
  await this.page.waitForURL(new RegExp(credentials.domain));
18358
18420
  }
18421
+ };
18422
+ signUp = async (params) => {
18423
+ await (IS_DEV_ENV
18424
+ ? this.signUpInDev(params)
18425
+ : this.signUpInStaging(params));
18359
18426
  const STORAGE_STATE = await this.page.context().storageState();
18360
18427
  return { STORAGE_STATE, baseURL: process.env.BASE_URL };
18361
18428
  };
@@ -18400,7 +18467,9 @@ class OrganizationPage {
18400
18467
  .click();
18401
18468
  await expect(countrySelector).toContainText(country);
18402
18469
  };
18403
- loginViaGoogleAuth = async () => {
18470
+ /** @deprecated Use `login({ via: "google" })`. */
18471
+ loginViaGoogleAuth = () => this.login({ via: LOGIN_STRATEGIES.google });
18472
+ completeGoogleAuth = async () => {
18404
18473
  const googlePage = new GooglePage({
18405
18474
  neetoPlaywrightUtilities: this.neetoPlaywrightUtilities,
18406
18475
  page: this.page,
@@ -129789,4 +129858,4 @@ class InboundEmailApis {
129789
129858
  };
129790
129859
  }
129791
129860
 
129792
- export { ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_KEYS_SELECTORS, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, ApiKeysPageV2, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomCommandsV2, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, HelpAndProfilePageV2, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_MAILPIT_ENABLED, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_SHADCN_UI, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_SELECTORS, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PRODUCT_ROLES_ROUTE_MAP, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, RolesPageV2, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, TeamMembersV2, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_TEST_EMAIL_V2, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getDirname, getFormattedPhoneNumber, getFullUrl, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, reviewAppBaseURL, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };
129861
+ export { ACTIONS, ADMIN_PANEL_SELECTORS, ALL_RESOURCES, ANALYTICS_RESOURCES, API_KEYS_SELECTORS, API_ROUTES, APP_RESOURCES, AUDIT_LOGS_SELECTORS, ApiKeysApi, ApiKeysPage, ApiKeysPageV2, AuditLogsPage, BASE_URL, CALENDAR_LABELS, CERTIFICATE_LIMIT_EXCEEDED_MESSAGE, CERTIFICATE_LIMIT_EXCEEDED_REGEXP, CERTIFICATE_PROVISION_FAILED_MESSAGE, CERTIFICATE_PROVISION_FAILED_REGEXP, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COLOR, COMMON_SELECTORS, COMMON_TEXTS, COMMUNITY_TEXTS, CREDENTIALS, CURRENT_TIME_RANGES, CUSTOM_DOMAIN_SELECTORS, CUSTOM_DOMAIN_SUFFIX, ColorPickerUtils, CustomCommands, CustomCommandsV2, CustomDomainApi, CustomDomainPage, DATE_FORMATS, DATE_PICKER_SELECTORS, DATE_RANGES, DATE_TEXTS, DEFAULT_TIMEZONE_ID, DEFAULT_WEBHOOKS_RESPONSE_TEXT, DESCRIPTION_EDITOR_TEXTS, EDITOR_VERIFY_TEXT_COLOR, EMBED_SELECTORS, EMOJI_LABEL, EMPTY_STORAGE_STATE, ENGAGE_TEXTS, ENVIRONMENT, EXAMPLE_URL, EXPANDED_FONT_SIZE, EXPORT_FILE_TYPES, EditorPage, EmailDeliveryUtils, EmbedBase, FILE_FORMATS, FONTS_RESOURCES, FONT_SIZE_SELECTORS, FROM_EMAIL_ENV_KEYS, GLOBAL_TRANSLATIONS_PATTERN, GOOGLE_ANALYTICS_SELECTORS, GOOGLE_CALENDAR_DATE_FORMAT, GOOGLE_LOGIN_SELECTORS, GOOGLE_LOGIN_TEXTS, GOOGLE_SHEETS_SELECTORS, GooglePage, HELP_CENTER_ROUTES, HELP_CENTER_SELECTORS, HelpAndProfilePage, HelpAndProfilePageV2, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IPRestrictionsPage, IP_RESTRICTIONS_SELECTORS, IS_CI, IS_DEV_CI, IS_DEV_ENV, IS_MAILPIT_ENABLED, IS_PLAYWRIGHT_RUN, IS_REVIEW_ENV, IS_SHADCN_UI, IS_STAGING_ENV, IS_WEBKIT, ImageUploader, InboundEmailApis, IntegrationBase, IpRestrictionsApi, KEYBOARD_SHORTCUTS_SELECTORS, KEYBOARD_SHORTCUT_TEST_CASES, LIST_MODIFIER_SELECTORS, LIST_MODIFIER_TAGS, LOGIN_DEFAULTS, LOGIN_SELECTORS, LOGIN_STRATEGIES, LOGIN_TIMEOUT, MAILPIT_BASE_URL, MAILPIT_DOMAIN_NAME, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MICROSOFT_LOGIN_SELECTORS, MICROSOFT_LOGIN_TEXTS, MailerUtils, MailpitApi, Member, MemberApis, MicrosoftPage, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, NEETO_IMAGE_UPLOADER_SELECTORS, NEETO_ROUTES, NEETO_SEO_SELECTORS, NEETO_TEXT_MODIFIER_SELECTORS, NeetoAuthServer, NeetoChatWidget, NeetoEmailDeliveryApi, NeetoTowerApi, ONBOARDING_SELECTORS, ORGANIZATION_TEXTS, OTP_EMAIL_PATTERN, OTP_FETCH_TIMEOUT, OrganizationPage, PAST_TIME_RANGES, PHONE_NUMBER_FORMATS, PLURAL, PRODUCT_ROLES_ROUTE_MAP, PROFILE_LINKS, PROFILE_SECTION_SELECTORS, PROJECT_NAMES, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, RailsEmailApiClient, RailsEmailUtils, RoleApis, RolesPage, RolesPageV2, SIGNUP_SELECTORS, SINGULAR, SLACK_DATA_QA_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STATUS_TEXTS, STORAGE_STATE, SecurityApi, SidebarSection, SlackApi, SlackPage, SmsApi, SmsUtils, TABLE_SELECTORS, TAB_SELECTORS, TAGS_SELECTORS, TEAM_MEMBER_TEXTS, TEXT_MODIFIER_ROLES, TEXT_MODIFIER_SELECTORS, TEXT_MODIFIER_TAGS, THANK_YOU_SELECTORS, THEMES_SELECTORS, THEMES_TEXTS, THIRD_PARTY_RESOURCES, THIRD_PARTY_ROUTES, TIME_RANGES, TOASTR_MESSAGES, TWILIO_SELECTORS, TagsApi, TagsPage, TeamMembers, TeamMembersV2, ThankYouApi, ThankYouPage, TwilioApi, USER_AGENTS, WEBHOOK_SELECTORS, WebhookSiteApi, WebhooksPage, ZAPIER_LIMIT_EXHAUSTED_MESSAGE, ZAPIER_SELECTORS, ZAPIER_TEST_EMAIL, ZAPIER_TEST_EMAIL_V2, ZAPIER_WEB_TEXTS, ZapierPage, authenticateUser, baseURLGenerator, basicHTMLContent, clearCredentials, commands, cpuThrottlingUsingCDP, createOrganizationViaApi, createOrganizationViaRake, currencyUtils, dataQa, decodeQRCodeFromFile, definePlaywrightConfig, exampleEmail, executeWithThrottledResources, extractSubdomainFromError, filterUtils, fixedMenuSelector, generatePhoneNumber, generatePhoneNumberDetails, generateRandomBypassEmail, generateRandomFile, generateStagingData, getByDataQA, getClipboardContent, getDirname, getFormattedPhoneNumber, getFullUrl, getGlobalUserProps, getGlobalUserState, getImagePathAndName, getIsoCodeFromPhoneCode, getListCount, globalShortcuts, grantClipboardPermissions, hexToRGB, hexToRGBA, i18nFixture, imageRegex, initializeCredentials, initializeReviewAppCredentials, initializeTestData, initializeTotp, isGithubIssueOpen, isStagingOrganizationExpired, joinHyphenCase, joinString, login, loginToReviewApp, mailpitDomainName, minutesAgo, networkConditions, networkThrottlingUsingCDP, optionSelector, readFileAsBrowserFile, readFileSyncIfExists, removeCredentialFile, reviewAppBaseURL, serializeFileForBrowser, shouldSkipCustomDomainSetup, shouldSkipSetupAndTeardown, simulateClickWithDelay, simulateTypingWithDelay, skipTest, squish, stealth as stealthTest, tableUtils, toCamelCase, updateCredentials, waitForReviewApp, warmup, withCookieCache, writeDataToFile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-playwright-commons",
3
- "version": "4.8.9",
3
+ "version": "4.8.10",
4
4
  "description": "A package encapsulating common playwright code across neeto projects.",
5
5
  "repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
6
6
  "license": "apache-2.0",