@bigbinary/neeto-playwright-commons 1.21.1 → 1.21.3

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
@@ -82,6 +82,48 @@ let MemberApis$1 = class MemberApis {
82
82
  }
83
83
  };
84
84
 
85
+ let RoleApis$1 = class RoleApis {
86
+ constructor(neetoPlaywrightUtilities) {
87
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
88
+ this.BASE_URL = "/team_members";
89
+ this.ORGANIZATION_ROLES_URL = `${this.BASE_URL}/organization_roles`;
90
+ this.fetch = (endpoint) => this.neetoPlaywrightUtilities.apiRequest({
91
+ url: `${this.BASE_URL}/${endpoint}`,
92
+ });
93
+ this.addRole = (roleName, permissionIds) => this.neetoPlaywrightUtilities.apiRequest({
94
+ url: this.ORGANIZATION_ROLES_URL,
95
+ method: "post",
96
+ data: {
97
+ organization_role: {
98
+ name: roleName,
99
+ permission_ids: permissionIds,
100
+ },
101
+ },
102
+ });
103
+ this.editRole = (roleId, body) => this.neetoPlaywrightUtilities.apiRequest({
104
+ url: `${this.ORGANIZATION_ROLES_URL}/${roleId}`,
105
+ method: "patch",
106
+ body: { organization_role: body },
107
+ });
108
+ this.deleteRole = (roleId, standardRoleId) => this.neetoPlaywrightUtilities.apiRequest({
109
+ url: `${this.ORGANIZATION_ROLES_URL}/${roleId}`,
110
+ method: "delete",
111
+ body: { new_role_id: standardRoleId },
112
+ });
113
+ }
114
+ };
115
+
116
+ let TagsApi$1 = class TagsApi {
117
+ constructor(neetoPlaywrightUtilities) {
118
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
119
+ this.create = ({ body, tagsRequestUrl, }) => this.neetoPlaywrightUtilities.apiRequest({
120
+ url: tagsRequestUrl,
121
+ body,
122
+ method: "post",
123
+ });
124
+ }
125
+ };
126
+
85
127
  const COMMON_SELECTORS = {
86
128
  emailInputError: "email-input-error",
87
129
  pane: "pane-wrapper",
@@ -192,7 +234,7 @@ const COMMON_SELECTORS = {
192
234
  continueButton: "continue-button",
193
235
  clearAllButton: "clear-all-button",
194
236
  requiredSwitch: "required-switch",
195
- customSwitch: (switchLabel) => ` ${neetoCist.hyphenate(switchLabel)}-switch`,
237
+ customSwitch: (switchLabel) => `${neetoCist.hyphenate(switchLabel)}-switch`,
196
238
  customMenuItem: (label) => `${neetoCist.hyphenate(label)}-menu-item`,
197
239
  customInputLabel: (name = "nui") => `${neetoCist.hyphenate(name)}-input-label`,
198
240
  customInputField: (name = "nui") => `${neetoCist.hyphenate(name)}-input-field`,
@@ -188537,7 +188579,11 @@ class ThankYouPage {
188537
188579
  await this.page
188538
188580
  .getByTestId(NEETO_EDITOR_SELECTORS.contentField)
188539
188581
  .fill(thankYouMessage);
188540
- await test$1.expect(this.page.getByTestId(THANK_YOU_SELECTORS.thankYouMessageWrapper).getByTestId(NEETO_EDITOR_SELECTORS.contentField)).toContainText(thankYouMessage);
188582
+ await test$1.expect(this.page
188583
+ .getByTestId(THANK_YOU_SELECTORS.previewEditorContent)
188584
+ .or(this.page
188585
+ .getByTestId(THANK_YOU_SELECTORS.thankYouMessageWrapper)
188586
+ .getByTestId(NEETO_EDITOR_SELECTORS.contentField))).toContainText(thankYouMessage);
188541
188587
  };
188542
188588
  this.addRedirectUrl = async (customRedirectUrl) => {
188543
188589
  await this.page
@@ -188795,12 +188841,12 @@ const ROUTES = {
188795
188841
  dashboard: "/dashboard",
188796
188842
  neetoThankYou: "/neeto_thank_you_engine",
188797
188843
  adminPanel: {
188798
- roles: "/admin/admin-panel/roles",
188799
- index: "/admin/admin-panel",
188800
- auditLogs: "/admin/admin-panel/audit-logs",
188801
- apiKeys: "/admin/admin-panel/apiKeys",
188802
- customDomain: "/admin/admin-panel/custom-domain",
188803
- ipRestriction: "/admin/admin-panel/ip-restriction",
188844
+ roles: "/admin/general/admin-panel/roles",
188845
+ index: "/admin/general/admin-panel",
188846
+ auditLogs: "/admin/admin-panel/general/audit-logs",
188847
+ apiKeys: "/admin/admin-panel/general/apiKeys",
188848
+ customDomain: "/admin/admin-panel/general/custom-domain",
188849
+ ipRestriction: "/admin/admin-panel/general/ip-restriction",
188804
188850
  },
188805
188851
  };
188806
188852
  const API_ROUTES = {
@@ -191355,14 +191401,15 @@ class SlackPage extends IntegrationBase {
191355
191401
  const loginButton = this.page.getByRole("button", {
191356
191402
  name: this.t("neetoSlack.slack.connect.loginButton"),
191357
191403
  });
191404
+ const allowButton = this.page.getByRole("button", {
191405
+ name: SLACK_WEB_TEXTS.allow,
191406
+ });
191358
191407
  if (await loginButton.isVisible()) {
191359
191408
  await loginButton.click({ delay: 5000 });
191360
191409
  await this.page.waitForURL(RegExp("(.*)slack.com/.*"));
191361
191410
  }
191362
- const allowButton = this.page.getByRole("button", {
191363
- name: SLACK_WEB_TEXTS.allow,
191364
- });
191365
- await test$1.expect(allowButton).toBeEnabled({ timeout: 30000 });
191411
+ await this.page.waitForLoadState("domcontentloaded", { timeout: 25000 });
191412
+ await test$1.expect(allowButton).toBeEnabled({ timeout: 45000 });
191366
191413
  const currentWorkspace = (await this.page
191367
191414
  .locator(SLACK_SELECTORS.teamPicketButtonContent)
191368
191415
  .textContent()) || "";
@@ -191439,6 +191486,7 @@ class SlackPage extends IntegrationBase {
191439
191486
  ramda.isNotNil(slackLoginPassword) &&
191440
191487
  ramda.isNotNil(slackLoginEmail)) {
191441
191488
  await slackWebappPage.goto(THIRD_PARTY_ROUTES.slack.loginWithPassword(slackWorkspace), { timeout: 20000 });
191489
+ await slackWebappPage.waitForLoadState("load", { timeout: 25000 });
191442
191490
  await slackWebappPage
191443
191491
  .locator(SLACK_SELECTORS.loginEmail)
191444
191492
  .pressSequentially(slackLoginEmail, { delay: 10 });
@@ -191446,6 +191494,9 @@ class SlackPage extends IntegrationBase {
191446
191494
  .locator(SLACK_SELECTORS.loginPassword)
191447
191495
  .pressSequentially(slackLoginPassword, { delay: 10 });
191448
191496
  await slackWebappPage.locator(SLACK_SELECTORS.signInButton).click();
191497
+ await slackWebappPage.waitForLoadState("domcontentloaded", {
191498
+ timeout: 25000,
191499
+ });
191449
191500
  const redirectOpenInBrowser = slackWebappPage.locator(SLACK_SELECTORS.redirectOpenInBrowser);
191450
191501
  await test$1.expect(redirectOpenInBrowser).toBeVisible({ timeout: 25000 });
191451
191502
  await redirectOpenInBrowser.click();
@@ -193064,44 +193115,7 @@ class AuditLogsPage {
193064
193115
  }
193065
193116
 
193066
193117
  class CustomDomainPage {
193067
- constructor(page, neetoPlaywrightUtilities, browser // Made optional to avoid breaking changes during the compliance release
193068
- ) {
193069
- this.addCustomDomainViaUI = async (domainName) => {
193070
- const addCustomDomainButton = this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.addCustomDomainButton);
193071
- await test$1.expect(addCustomDomainButton).toBeVisible();
193072
- (await addCustomDomainButton.isDisabled()) &&
193073
- (await this.deleteCustomDomainViaUI());
193074
- await addCustomDomainButton.click();
193075
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody)).toBeVisible();
193076
- await this.page
193077
- .getByTestId(CUSTOM_DOMAIN_SELECTORS.customDomainInputField)
193078
- .fill(domainName);
193079
- await this.page
193080
- .getByTestId(CUSTOM_DOMAIN_SELECTORS.submitCustomDomainButton)
193081
- .click();
193082
- await Promise.all([
193083
- test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody).getByText(domainName)).toBeVisible(),
193084
- test$1.expect(this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.customDomainValidateButton)).toBeVisible(),
193085
- ]);
193086
- await this.page.getByTestId(COMMON_SELECTORS.paneModalCrossIcon).click();
193087
- await Promise.all([
193088
- test$1.expect(this.page.getByTestId(COMMON_SELECTORS.paneBody)).toBeHidden(),
193089
- test$1.expect(addCustomDomainButton).toBeDisabled(),
193090
- test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pendingTagContainer)).toBeVisible(),
193091
- ]);
193092
- };
193093
- this.deleteCustomDomainViaUI = async () => {
193094
- await this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.dropdownButton).click();
193095
- await this.page
193096
- .getByTestId(CUSTOM_DOMAIN_SELECTORS.deleteCustomDomainButton)
193097
- .click();
193098
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.alertTitle)).toHaveText(this.t("neetoCustomDomains.delete"));
193099
- await this.page
193100
- .getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
193101
- .click();
193102
- await this.neetoPlaywrightUtilities.verifyToast();
193103
- await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible();
193104
- };
193118
+ constructor({ browser, page, neetoPlaywrightUtilities, product, }) {
193105
193119
  this.getCustomDomain = (newSubdomain) => {
193106
193120
  const { subdomainName } = getGlobalUserState();
193107
193121
  this.subdomain = newSubdomain !== null && newSubdomain !== void 0 ? newSubdomain : subdomainName;
@@ -193127,6 +193141,7 @@ class CustomDomainPage {
193127
193141
  await test$1.expect(async () => {
193128
193142
  await validateButton.click();
193129
193143
  await this.neetoPlaywrightUtilities.verifyToast({
193144
+ timeout: 15000,
193130
193145
  message: this.t("neetoCustomDomains.validation.successMessage"),
193131
193146
  });
193132
193147
  }).toPass({ timeout: 60000 });
@@ -193134,13 +193149,14 @@ class CustomDomainPage {
193134
193149
  await test$1.expect(this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.activeTagContainer)).toBeVisible();
193135
193150
  };
193136
193151
  this.loginToCustomDomain = async () => {
193137
- void this.page.close();
193152
+ await this.page.close();
193138
193153
  const loginPage = this.loginPage;
193139
193154
  const { email } = getGlobalUserState();
193140
193155
  const loginUrl = `${this.baseURL}${ROUTES.admin}`;
193141
193156
  const playwrightUtils = new CustomCommands(loginPage, loginPage.request);
193142
193157
  const organizationPage = new OrganizationPage(loginPage, playwrightUtils);
193143
193158
  await loginPage.goto(loginUrl);
193159
+ await playwrightUtils.waitForPageLoad();
193144
193160
  await organizationPage.loginViaSSO(email);
193145
193161
  await test$1.expect(loginPage).toHaveURL(RegExp(loginUrl), { timeout: 15000 });
193146
193162
  await playwrightUtils.waitForPageLoad();
@@ -193165,21 +193181,22 @@ class CustomDomainPage {
193165
193181
  updateCredentials({ key: "baseUrl", value: this.baseURL });
193166
193182
  updateCredentials({ key: "domain", value: CUSTOM_DOMAIN_SUFFIX });
193167
193183
  };
193168
- this.setupCustomDomain = async (product) => {
193184
+ this.setupCustomDomain = async () => {
193169
193185
  if (shouldSkipCustomDomainSetup())
193170
193186
  return;
193171
- await this.connectCustomDomain(product);
193187
+ await this.connectCustomDomain();
193172
193188
  const context = await this.browser.newContext(EMPTY_STORAGE_STATE);
193173
193189
  this.loginPage = await context.newPage();
193174
193190
  await this.loginToCustomDomain();
193175
193191
  await this.saveCustomDomainState();
193176
193192
  };
193177
- this.connectCustomDomain = async (product, subdomain) => {
193193
+ this.connectCustomDomain = async (subdomain) => {
193178
193194
  if (shouldSkipCustomDomainSetup())
193179
193195
  return;
193180
- const baseURL = baseURLGenerator(product, subdomain);
193196
+ const baseURL = baseURLGenerator(this.product, subdomain);
193181
193197
  const domain = this.getCustomDomain(subdomain);
193182
193198
  this.baseURL = `https://${domain}`;
193199
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
193183
193200
  await this.page.goto(`${baseURL}${ROUTES.adminPanel.customDomain}`);
193184
193201
  await this.neetoPlaywrightUtilities.waitForPageLoad();
193185
193202
  await this.addCustomDomain(domain);
@@ -193187,10 +193204,11 @@ class CustomDomainPage {
193187
193204
  process.env.BASE_URL = this.baseURL;
193188
193205
  await this.waitForTrustedSSL();
193189
193206
  };
193190
- this.disconnectCustomDomain = async (product, subdomain) => {
193207
+ this.disconnectCustomDomain = async () => {
193191
193208
  if (shouldSkipCustomDomainSetup())
193192
193209
  return;
193193
- const baseURL = baseURLGenerator(product, subdomain);
193210
+ const baseURL = baseURLGenerator(this.product, this.subdomain);
193211
+ await this.neetoPlaywrightUtilities.waitForPageLoad();
193194
193212
  await this.page.goto(`${baseURL}${ROUTES.adminPanel.customDomain}`);
193195
193213
  await this.neetoPlaywrightUtilities.waitForPageLoad();
193196
193214
  await this.page.getByTestId(CUSTOM_DOMAIN_SELECTORS.dropdownButton).click();
@@ -193204,10 +193222,11 @@ class CustomDomainPage {
193204
193222
  await this.neetoPlaywrightUtilities.verifyToast();
193205
193223
  await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.noDataTitle)).toBeVisible();
193206
193224
  };
193207
- this.browser = browser;
193208
193225
  this.page = page;
193209
- this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
193226
+ this.browser = browser;
193227
+ this.product = product;
193210
193228
  this.t = playwrightI18nextFixture.getI18nInstance().t;
193229
+ this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
193211
193230
  }
193212
193231
  }
193213
193232
 
@@ -195436,7 +195455,7 @@ exports.CREDENTIALS = CREDENTIALS;
195436
195455
  exports.CUSTOM_DOMAIN_SELECTORS = CUSTOM_DOMAIN_SELECTORS;
195437
195456
  exports.CUSTOM_DOMAIN_SUFFIX = CUSTOM_DOMAIN_SUFFIX;
195438
195457
  exports.CustomCommands = CustomCommands;
195439
- exports.CustomDomainsPage = CustomDomainPage;
195458
+ exports.CustomDomainPage = CustomDomainPage;
195440
195459
  exports.DATE_PICKER_SELECTORS = DATE_PICKER_SELECTORS;
195441
195460
  exports.DATE_TEXTS = DATE_TEXTS;
195442
195461
  exports.DESCRIPTION_EDITOR_TEXTS = DESCRIPTION_EDITOR_TEXTS;
@@ -195487,6 +195506,7 @@ exports.PROFILE_SECTION_SELECTORS = PROFILE_SECTION_SELECTORS;
195487
195506
  exports.PROJECT_TRANSLATIONS_PATH = PROJECT_TRANSLATIONS_PATH;
195488
195507
  exports.ROLES_SELECTORS = ROLES_SELECTORS;
195489
195508
  exports.ROUTES = ROUTES;
195509
+ exports.RoleApis = RoleApis$1;
195490
195510
  exports.RolesPage = RolesPage;
195491
195511
  exports.SELECT_COUNTRY = SELECT_COUNTRY;
195492
195512
  exports.SIGNUP_SELECTORS = SIGNUP_SELECTORS;
@@ -195509,6 +195529,7 @@ exports.THANK_YOU_SELECTORS = THANK_YOU_SELECTORS;
195509
195529
  exports.THEMES_SELECTORS = THEMES_SELECTORS;
195510
195530
  exports.THIRD_PARTY_ROUTES = THIRD_PARTY_ROUTES;
195511
195531
  exports.TOASTR_MESSAGES = TOASTR_MESSAGES;
195532
+ exports.TagsApi = TagsApi$1;
195512
195533
  exports.TagsPage = TagsPage;
195513
195534
  exports.TeamMembers = TeamMembers;
195514
195535
  exports.ThankYouPage = ThankYouPage;