@bigbinary/neeto-playwright-commons 1.8.44 → 1.8.46
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 +153 -79
- package/index.cjs.js.map +1 -1
- package/index.d.ts +55 -3
- package/index.js +153 -79
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -12568,6 +12568,7 @@ const ROUTES = {
|
|
|
12568
12568
|
neetoAuth: NEETO_AUTH_BASE_URL(),
|
|
12569
12569
|
loginLink: "/login",
|
|
12570
12570
|
profile: "/profile",
|
|
12571
|
+
admin: "/admin",
|
|
12571
12572
|
myProfile: "/my/profile",
|
|
12572
12573
|
authSettings: "/settings",
|
|
12573
12574
|
webhooks: "/webhooks",
|
|
@@ -12880,10 +12881,12 @@ class HelpAndProfilePage {
|
|
|
12880
12881
|
await test$1.expect(profileSidebarHeader).toBeHidden();
|
|
12881
12882
|
});
|
|
12882
12883
|
await test$1.test.step("Step 3: Open Help center and verify", this.openHelpCenterV2);
|
|
12883
|
-
await test$1.test.step("Step 4: Open My organization link and verify", async () =>
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12884
|
+
await test$1.test.step("Step 4: Open My organization link and verify", async () => {
|
|
12885
|
+
await this.page
|
|
12886
|
+
.getByTestId(PROFILE_SECTION_SELECTORS.profileOrganizationSettingsButton)
|
|
12887
|
+
.click();
|
|
12888
|
+
await test$1.expect(this.page).toHaveURL(new RegExp(ROUTES.authSettings));
|
|
12889
|
+
});
|
|
12887
12890
|
};
|
|
12888
12891
|
this.verifyLogoutV2 = async () => {
|
|
12889
12892
|
if (shouldSkipSetupAndTeardown())
|
|
@@ -13490,6 +13493,18 @@ class ZapierPage extends IntegrationBase {
|
|
|
13490
13493
|
}
|
|
13491
13494
|
}
|
|
13492
13495
|
|
|
13496
|
+
const LOGIN_SELECTORS = {
|
|
13497
|
+
appleAuthenticationButton: "apple-authentication-button",
|
|
13498
|
+
emailTextField: "login-email-text-field",
|
|
13499
|
+
googleAuthenticationButton: "google-authentication-button",
|
|
13500
|
+
githubAuthenticationButton: "github-authentication-button",
|
|
13501
|
+
loginViaEmailButton: "login-via-email-button",
|
|
13502
|
+
passwordTextField: "login-password-text-field",
|
|
13503
|
+
rememberMeCheckBox: "login-remember-me-check-box",
|
|
13504
|
+
submitButton: "login-submit-button",
|
|
13505
|
+
twitterAuthenticationButton: "twitter-authentication-button",
|
|
13506
|
+
};
|
|
13507
|
+
|
|
13493
13508
|
const SIGNUP_SELECTORS = {
|
|
13494
13509
|
emailTextField: "signup-email-text-field",
|
|
13495
13510
|
firstNameTextField: "signup-profile-first-name-text-field",
|
|
@@ -13506,6 +13521,29 @@ const SIGNUP_SELECTORS = {
|
|
|
13506
13521
|
unregisterdEmailError: "unregisterd-email-error",
|
|
13507
13522
|
};
|
|
13508
13523
|
|
|
13524
|
+
const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, loginPath = "/", }) => {
|
|
13525
|
+
if (shouldSkipSetupAndTeardown())
|
|
13526
|
+
return;
|
|
13527
|
+
await page.goto(loginPath);
|
|
13528
|
+
await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
|
|
13529
|
+
await page
|
|
13530
|
+
.getByTestId("login-password-text-field")
|
|
13531
|
+
.fill(CREDENTIALS.password);
|
|
13532
|
+
const login = neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
13533
|
+
times: 1,
|
|
13534
|
+
});
|
|
13535
|
+
await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
|
|
13536
|
+
await login;
|
|
13537
|
+
const userCredentials = readFileSyncIfExists();
|
|
13538
|
+
await page.context().storageState({ path: STORAGE_STATE });
|
|
13539
|
+
const mergedCredentials = ramda.mergeAll([readFileSyncIfExists(), userCredentials]);
|
|
13540
|
+
writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
|
|
13541
|
+
updateCredentials({ key: "isLoggedIn", value: "true" });
|
|
13542
|
+
};
|
|
13543
|
+
const login = async ({ page, neetoPlaywrightUtilities, loginPath, }) => !IS_STAGING_ENV &&
|
|
13544
|
+
(await loginWithoutSSO({ page, neetoPlaywrightUtilities, loginPath }));
|
|
13545
|
+
const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.faker.number.int()}@bigbinary.com`;
|
|
13546
|
+
|
|
13509
13547
|
const extractSubdomainFromError = (errorString) => {
|
|
13510
13548
|
const regex = /cpt[a-zA-Z0-9-]+/g;
|
|
13511
13549
|
const matches = errorString.match(regex);
|
|
@@ -13538,47 +13576,18 @@ class OrganizationPage {
|
|
|
13538
13576
|
await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
|
|
13539
13577
|
await signup;
|
|
13540
13578
|
await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(defaultOtp);
|
|
13541
|
-
await this.
|
|
13542
|
-
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13546
|
-
|
|
13547
|
-
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
await fetchSubdomainAvailability;
|
|
13553
|
-
const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
|
|
13554
|
-
const subdomainErrorCount = await subdomainError.count();
|
|
13555
|
-
if (subdomainErrorCount !== 0) {
|
|
13556
|
-
await this.updateSubdomainIfExists(appNameInLowerCase);
|
|
13557
|
-
}
|
|
13558
|
-
const fetchProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
13559
|
-
times: 2,
|
|
13560
|
-
timeout: 60 * 1000,
|
|
13561
|
-
baseUrl: NEETO_AUTH_BASE_URL(),
|
|
13562
|
-
});
|
|
13563
|
-
await this.page
|
|
13564
|
-
.getByTestId(SIGNUP_SELECTORS.organizationSubmitButton)
|
|
13565
|
-
.click();
|
|
13566
|
-
await fetchProfile;
|
|
13567
|
-
await this.page.waitForURL(`**${ROUTES.profile}`, { timeout: 60 * 1000 });
|
|
13568
|
-
await this.page
|
|
13569
|
-
.getByTestId(SIGNUP_SELECTORS.firstNameTextField)
|
|
13570
|
-
.fill(firstName);
|
|
13571
|
-
await this.page
|
|
13572
|
-
.getByTestId(SIGNUP_SELECTORS.lastNameTextField)
|
|
13573
|
-
.fill(lastName);
|
|
13574
|
-
await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
|
|
13575
|
-
const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
13576
|
-
responseUrl: ROUTES.signup,
|
|
13577
|
-
timeout: 1000 * 60,
|
|
13578
|
-
baseUrl: NEETO_AUTH_BASE_URL(),
|
|
13579
|
+
await this.fillOrganizationDetails({
|
|
13580
|
+
credentials: {
|
|
13581
|
+
firstName,
|
|
13582
|
+
lastName,
|
|
13583
|
+
email,
|
|
13584
|
+
currentUserName: email,
|
|
13585
|
+
businessName,
|
|
13586
|
+
subdomainName,
|
|
13587
|
+
domain: appNameInLowerCase,
|
|
13588
|
+
},
|
|
13589
|
+
appName: appNameInLowerCase,
|
|
13579
13590
|
});
|
|
13580
|
-
await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
|
|
13581
|
-
await submitProfile;
|
|
13582
13591
|
await this.page.waitForURL(new RegExp(getGlobalUserState().domain), {
|
|
13583
13592
|
waitUntil: "load",
|
|
13584
13593
|
});
|
|
@@ -13647,6 +13656,106 @@ class OrganizationPage {
|
|
|
13647
13656
|
}
|
|
13648
13657
|
}
|
|
13649
13658
|
};
|
|
13659
|
+
this.loginViaSSO = async (email = generateRandomBypassEmail()) => {
|
|
13660
|
+
await this.page.getByTestId(LOGIN_SELECTORS.emailTextField).fill(email);
|
|
13661
|
+
await test$1.expect(async () => {
|
|
13662
|
+
await this.page.getByTestId(LOGIN_SELECTORS.submitButton).click();
|
|
13663
|
+
await test$1.expect(this.page.getByTestId(SIGNUP_SELECTORS.unregisterdEmailError)).toBeHidden();
|
|
13664
|
+
}).toPass({ timeout: 15000 });
|
|
13665
|
+
await this.page
|
|
13666
|
+
.getByTestId(SIGNUP_SELECTORS.otpTextBox)
|
|
13667
|
+
.fill(faker.faker.string.numeric(6));
|
|
13668
|
+
};
|
|
13669
|
+
this.setupProfile = async ({ firstName = faker.faker.person.firstName(), lastName = faker.faker.person.lastName(), } = {}) => {
|
|
13670
|
+
await this.page
|
|
13671
|
+
.getByTestId(SIGNUP_SELECTORS.firstNameTextField)
|
|
13672
|
+
.fill(firstName);
|
|
13673
|
+
await this.page
|
|
13674
|
+
.getByTestId(SIGNUP_SELECTORS.lastNameTextField)
|
|
13675
|
+
.fill(lastName);
|
|
13676
|
+
await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
|
|
13677
|
+
const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
13678
|
+
customPageContext: this.page,
|
|
13679
|
+
responseUrl: ROUTES.signup,
|
|
13680
|
+
baseUrl: NEETO_AUTH_BASE_URL(),
|
|
13681
|
+
timeout: 60000,
|
|
13682
|
+
});
|
|
13683
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
|
|
13684
|
+
await submitProfile;
|
|
13685
|
+
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden();
|
|
13686
|
+
};
|
|
13687
|
+
this.loginAndOnboard = async ({ email, firstName, lastName, handleOnboarding, }) => {
|
|
13688
|
+
await this.page.goto(ROUTES.admin);
|
|
13689
|
+
await this.loginViaSSO(email);
|
|
13690
|
+
await this.setupProfile({ firstName, lastName });
|
|
13691
|
+
await this.page.waitForURL(new RegExp(getGlobalUserState().domain), {
|
|
13692
|
+
waitUntil: "load",
|
|
13693
|
+
});
|
|
13694
|
+
await handleOnboarding();
|
|
13695
|
+
};
|
|
13696
|
+
this.signUp = async ({ credentials, fetchOtpFromEmail, appName, }) => {
|
|
13697
|
+
let otp = "123456";
|
|
13698
|
+
await this.page.goto(`${ROUTES.neetoAuthSignup}?redirect_uri=${credentials.domain}`);
|
|
13699
|
+
await this.page
|
|
13700
|
+
.getByTestId(SIGNUP_SELECTORS.emailTextField)
|
|
13701
|
+
.fill(credentials.email);
|
|
13702
|
+
const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
13703
|
+
responseUrl: ROUTES.signup,
|
|
13704
|
+
timeout: 60 * 1000,
|
|
13705
|
+
baseUrl: NEETO_AUTH_BASE_URL(),
|
|
13706
|
+
});
|
|
13707
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
|
|
13708
|
+
await signup;
|
|
13709
|
+
if (fetchOtpFromEmail !== undefined) {
|
|
13710
|
+
otp = await fetchOtpFromEmail({
|
|
13711
|
+
email: credentials.email,
|
|
13712
|
+
timeout: 4 * 60 * 1000,
|
|
13713
|
+
});
|
|
13714
|
+
}
|
|
13715
|
+
await this.page.getByTestId(SIGNUP_SELECTORS.otpTextBox).fill(otp);
|
|
13716
|
+
await this.fillOrganizationDetails({
|
|
13717
|
+
credentials,
|
|
13718
|
+
appName,
|
|
13719
|
+
});
|
|
13720
|
+
await this.page.waitForURL(new RegExp(credentials.domain));
|
|
13721
|
+
const STORAGE_STATE = await this.page.context().storageState();
|
|
13722
|
+
return { STORAGE_STATE, baseURL: process.env.BASE_URL };
|
|
13723
|
+
};
|
|
13724
|
+
this.fillOrganizationDetails = async ({ credentials, appName, }) => {
|
|
13725
|
+
await this.page
|
|
13726
|
+
.getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
|
|
13727
|
+
.fill(credentials.businessName);
|
|
13728
|
+
const fetchSubdomainAvailability = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
13729
|
+
responseUrl: ROUTES.subdomainAvailability,
|
|
13730
|
+
timeout: 60 * 1000,
|
|
13731
|
+
baseUrl: NEETO_AUTH_BASE_URL(),
|
|
13732
|
+
});
|
|
13733
|
+
await this.page
|
|
13734
|
+
.getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
|
|
13735
|
+
.fill(credentials.subdomainName);
|
|
13736
|
+
await fetchSubdomainAvailability;
|
|
13737
|
+
const subdomainError = this.page.getByTestId(SIGNUP_SELECTORS.subdomainError);
|
|
13738
|
+
const subdomainErrorCount = await subdomainError.count();
|
|
13739
|
+
if (subdomainErrorCount !== 0) {
|
|
13740
|
+
await this.updateSubdomainIfExists(appName);
|
|
13741
|
+
}
|
|
13742
|
+
const fetchProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
13743
|
+
times: 2,
|
|
13744
|
+
timeout: 60 * 1000,
|
|
13745
|
+
baseUrl: NEETO_AUTH_BASE_URL(),
|
|
13746
|
+
});
|
|
13747
|
+
await this.page
|
|
13748
|
+
.getByTestId(SIGNUP_SELECTORS.organizationSubmitButton)
|
|
13749
|
+
.click();
|
|
13750
|
+
await fetchProfile;
|
|
13751
|
+
await this.page.waitForURL(`**${ROUTES.profile}`, {
|
|
13752
|
+
timeout: 60 * 1000,
|
|
13753
|
+
});
|
|
13754
|
+
await this.setupProfile({
|
|
13755
|
+
firstName: credentials.firstName,
|
|
13756
|
+
lastName: credentials.lastName,
|
|
13757
|
+
});
|
|
13758
|
+
};
|
|
13650
13759
|
this.page = page;
|
|
13651
13760
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
13652
13761
|
}
|
|
@@ -13730,18 +13839,6 @@ const NEETO_FILTERS_SELECTORS = {
|
|
|
13730
13839
|
paneModalCrossIcon: "neeto-filters-close-button",
|
|
13731
13840
|
};
|
|
13732
13841
|
|
|
13733
|
-
const LOGIN_SELECTORS = {
|
|
13734
|
-
appleAuthenticationButton: "apple-authentication-button",
|
|
13735
|
-
emailTextField: "login-email-text-field",
|
|
13736
|
-
googleAuthenticationButton: "google-authentication-button",
|
|
13737
|
-
githubAuthenticationButton: "github-authentication-button",
|
|
13738
|
-
loginViaEmailButton: "login-via-email-button",
|
|
13739
|
-
passwordTextField: "login-password-text-field",
|
|
13740
|
-
rememberMeCheckBox: "login-remember-me-check-box",
|
|
13741
|
-
submitButton: "login-submit-button",
|
|
13742
|
-
twitterAuthenticationButton: "twitter-authentication-button",
|
|
13743
|
-
};
|
|
13744
|
-
|
|
13745
13842
|
const MEMBER_SELECTORS = {
|
|
13746
13843
|
membersTab: "members-nav-tab",
|
|
13747
13844
|
newButton: "ntm-add-member-button",
|
|
@@ -13845,29 +13942,6 @@ const initializeCredentials = (product) => {
|
|
|
13845
13942
|
}
|
|
13846
13943
|
};
|
|
13847
13944
|
|
|
13848
|
-
const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, loginPath = "/", }) => {
|
|
13849
|
-
if (shouldSkipSetupAndTeardown())
|
|
13850
|
-
return;
|
|
13851
|
-
await page.goto(loginPath);
|
|
13852
|
-
await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
|
|
13853
|
-
await page
|
|
13854
|
-
.getByTestId("login-password-text-field")
|
|
13855
|
-
.fill(CREDENTIALS.password);
|
|
13856
|
-
const login = neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
13857
|
-
times: 1,
|
|
13858
|
-
});
|
|
13859
|
-
await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
|
|
13860
|
-
await login;
|
|
13861
|
-
const userCredentials = readFileSyncIfExists();
|
|
13862
|
-
await page.context().storageState({ path: STORAGE_STATE });
|
|
13863
|
-
const mergedCredentials = ramda.mergeAll([readFileSyncIfExists(), userCredentials]);
|
|
13864
|
-
writeDataToFile(JSON.stringify(mergedCredentials, null, 2));
|
|
13865
|
-
updateCredentials({ key: "isLoggedIn", value: "true" });
|
|
13866
|
-
};
|
|
13867
|
-
const login = async ({ page, neetoPlaywrightUtilities, loginPath, }) => !IS_STAGING_ENV &&
|
|
13868
|
-
(await loginWithoutSSO({ page, neetoPlaywrightUtilities, loginPath }));
|
|
13869
|
-
const generateRandomBypassEmail = () => `cpt${process.env.OTP_BYPASS_KEY}+${faker.faker.number.int()}@bigbinary.com`;
|
|
13870
|
-
|
|
13871
13945
|
const addMemberViaRequest = ({ email, role = MEMBER_TEXTS.agent, appName, neetoPlaywrightUtilities, }) => neetoPlaywrightUtilities.apiRequest({
|
|
13872
13946
|
method: "post",
|
|
13873
13947
|
url: API_ROUTES.teamMembers.index,
|