@bigbinary/neeto-playwright-commons 1.8.10 → 1.8.12
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 +247 -0
- package/index.cjs.js.map +1 -1
- package/index.d.ts +71 -1
- package/index.js +244 -1
- package/index.js.map +1 -1
- package/package.json +2 -1
package/index.cjs.js
CHANGED
|
@@ -14,6 +14,7 @@ var require$$0$2 = require('util');
|
|
|
14
14
|
var require$$0$3 = require('stream');
|
|
15
15
|
var require$$0$4 = require('events');
|
|
16
16
|
var playwrightI18nextFixture = require('playwright-i18next-fixture');
|
|
17
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
17
18
|
var require$$3 = require('crypto');
|
|
18
19
|
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -63,6 +64,7 @@ const CREDENTIALS = {
|
|
|
63
64
|
password: "welcome",
|
|
64
65
|
};
|
|
65
66
|
const OTP_EMAIL_PATTERN = "is your login code";
|
|
67
|
+
const SLACK_DEFAULT_CHANNEL = "general";
|
|
66
68
|
|
|
67
69
|
/* eslint-disable playwright/no-skipped-test */
|
|
68
70
|
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
@@ -172,6 +174,7 @@ const COMMON_SELECTORS = {
|
|
|
172
174
|
modalHeader: "modal-header",
|
|
173
175
|
nameInputError: "name-input-error",
|
|
174
176
|
selectContainer: "nui-select-container",
|
|
177
|
+
selectValueContainer: "nui-select-value-container",
|
|
175
178
|
dropdownMenu: "nui-select-menu",
|
|
176
179
|
sidebarToggle: "neeto-molecules-sidebar-toggler",
|
|
177
180
|
subheader: "subheader",
|
|
@@ -184,6 +187,8 @@ const COMMON_SELECTORS = {
|
|
|
184
187
|
homeButton: "home-button",
|
|
185
188
|
neetoUiSwitch: "nui-switch",
|
|
186
189
|
floatingActionMenuButton: "floating-action-menu-container",
|
|
190
|
+
columnsDropdownContainer: "columns-dropdown-container",
|
|
191
|
+
columnsDropdownButton: "columns-dropdown-button",
|
|
187
192
|
};
|
|
188
193
|
|
|
189
194
|
class CustomCommands {
|
|
@@ -7213,6 +7218,9 @@ const API_ROUTES = {
|
|
|
7213
7218
|
};
|
|
7214
7219
|
const THIRD_PARTY_ROUTES = {
|
|
7215
7220
|
webhooks: { site: "https://webhook.site/" },
|
|
7221
|
+
slack: {
|
|
7222
|
+
loginWithPassword: (workspace) => `https://${workspace}.slack.com/sign_in_with_password`,
|
|
7223
|
+
},
|
|
7216
7224
|
};
|
|
7217
7225
|
|
|
7218
7226
|
const CHAT_WIDGET_TEXTS = {
|
|
@@ -7222,6 +7230,14 @@ const CHAT_WIDGET_TEXTS = {
|
|
|
7222
7230
|
const MEMBER_TEXTS = {
|
|
7223
7231
|
agent: "Agent",
|
|
7224
7232
|
};
|
|
7233
|
+
const INTEGRATIONS_TEXTS = {
|
|
7234
|
+
connectHeader: (integration) => `Connect your ${neetoCist.humanize(integration)} account`,
|
|
7235
|
+
connectedHeader: (integration) => `You are connected to ${neetoCist.humanize(integration)}`,
|
|
7236
|
+
};
|
|
7237
|
+
const SLACK_WEB_TEXTS = {
|
|
7238
|
+
signOut: "Sign out",
|
|
7239
|
+
allow: "Allow",
|
|
7240
|
+
};
|
|
7225
7241
|
|
|
7226
7242
|
const HELP_CENTER_SELECTORS = {
|
|
7227
7243
|
helpButton: "help-button",
|
|
@@ -7658,6 +7674,199 @@ class HelpAndProfilePage {
|
|
|
7658
7674
|
}
|
|
7659
7675
|
}
|
|
7660
7676
|
|
|
7677
|
+
const INTEGRATION_SELECTORS = {
|
|
7678
|
+
integrationCard: (integration) => `${integration}-integration-card`,
|
|
7679
|
+
connectButton: "connect-button",
|
|
7680
|
+
integrationStatusTag: "integration-status-tag",
|
|
7681
|
+
disconnectButton: "disconnect-button",
|
|
7682
|
+
manageButton: "manage-button",
|
|
7683
|
+
};
|
|
7684
|
+
|
|
7685
|
+
class IntegrationBase {
|
|
7686
|
+
constructor({ page, neetoPlaywrightUtilities, integration, integrationRouteIndex, connectHeader, connectedHeader, }) {
|
|
7687
|
+
this.disconnect = async (interceptMultipleResponsesParams = {}) => {
|
|
7688
|
+
await this.gotoIntegrationIndex();
|
|
7689
|
+
await this.clickOnIntegrationCard();
|
|
7690
|
+
await this.page.getByTestId(INTEGRATION_SELECTORS.disconnectButton).click();
|
|
7691
|
+
const disconnectPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7692
|
+
times: 0,
|
|
7693
|
+
...interceptMultipleResponsesParams,
|
|
7694
|
+
});
|
|
7695
|
+
await this.page
|
|
7696
|
+
.getByTestId(COMMON_SELECTORS.alertModalSubmitButton)
|
|
7697
|
+
.click();
|
|
7698
|
+
await disconnectPromise;
|
|
7699
|
+
};
|
|
7700
|
+
this.connect = async (skipGoTo) => {
|
|
7701
|
+
!skipGoTo && (await this.gotoIntegrationIndex());
|
|
7702
|
+
await this.clickOnIntegrationCard();
|
|
7703
|
+
await test.expect(this.page.getByRole("heading", {
|
|
7704
|
+
name: this.connectHeader,
|
|
7705
|
+
})).toBeVisible();
|
|
7706
|
+
await this.page.getByTestId(INTEGRATION_SELECTORS.connectButton).click();
|
|
7707
|
+
};
|
|
7708
|
+
this.verifyIntegrationStatus = async (status = "connected") => {
|
|
7709
|
+
await this.gotoIntegrationIndex();
|
|
7710
|
+
if (status === "connected") {
|
|
7711
|
+
await test.expect(this.integrationCard.getByTestId(INTEGRATION_SELECTORS.integrationStatusTag)).toBeVisible({ timeout: 10000 });
|
|
7712
|
+
}
|
|
7713
|
+
await this.clickOnIntegrationCard();
|
|
7714
|
+
const header = status === "connected" ? this.connectedHeader : this.connectHeader;
|
|
7715
|
+
await test.expect(this.page.getByRole("heading", { name: header })).toBeVisible();
|
|
7716
|
+
};
|
|
7717
|
+
this.clickOnIntegrationCard = async () => {
|
|
7718
|
+
await test.expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toHaveCount(0);
|
|
7719
|
+
await this.integrationCard.scrollIntoViewIfNeeded();
|
|
7720
|
+
await this.integrationCard.click();
|
|
7721
|
+
await test.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden();
|
|
7722
|
+
};
|
|
7723
|
+
this.gotoIntegrationIndex = async () => {
|
|
7724
|
+
neetoCist.isNotEmpty(this.integrationRouteIndex) &&
|
|
7725
|
+
(await this.page.goto(this.integrationRouteIndex));
|
|
7726
|
+
};
|
|
7727
|
+
this.page = page;
|
|
7728
|
+
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
7729
|
+
this.t = playwrightI18nextFixture.getI18nInstance().t;
|
|
7730
|
+
this.integration = integration;
|
|
7731
|
+
this.integrationCard = this.page.getByTestId(INTEGRATION_SELECTORS.integrationCard(integration));
|
|
7732
|
+
this.integrationRouteIndex = integrationRouteIndex || "";
|
|
7733
|
+
this.connectHeader =
|
|
7734
|
+
connectHeader || INTEGRATIONS_TEXTS.connectHeader(this.integration);
|
|
7735
|
+
this.connectedHeader =
|
|
7736
|
+
connectedHeader || INTEGRATIONS_TEXTS.connectedHeader(this.integration);
|
|
7737
|
+
}
|
|
7738
|
+
}
|
|
7739
|
+
|
|
7740
|
+
const SLACK_SELECTORS = {
|
|
7741
|
+
messageContainer: "[data-qa='message_container']",
|
|
7742
|
+
loginEmail: "[data-qa='login_email']",
|
|
7743
|
+
loginPassword: "[data-qa='login_password']",
|
|
7744
|
+
signInButton: "[data-qa='signin_button']",
|
|
7745
|
+
teamPicketButtonContent: "[data-qa='team-picker-button-content']",
|
|
7746
|
+
redirectOpenInBrowser: "[data-qa='ssb_redirect_open_in_browser']",
|
|
7747
|
+
workspaceActionsButton: "[data-qa='workspace_actions_button']",
|
|
7748
|
+
teamMenuTrigger: "[data-qa='team-menu-trigger']",
|
|
7749
|
+
menuItemButton: "[data-qa='menu_item_button']",
|
|
7750
|
+
threadsFlexpane: "[data-qa='threads_flexpane']",
|
|
7751
|
+
replyBar: "[data-qa='reply_bar']",
|
|
7752
|
+
markdownElement: "[data-qa='bk_markdown_element']",
|
|
7753
|
+
virtualListItem: "[data-qa='virtual-list-item']",
|
|
7754
|
+
};
|
|
7755
|
+
|
|
7756
|
+
/* eslint-disable playwright/no-raw-locators */
|
|
7757
|
+
class SlackPage extends IntegrationBase {
|
|
7758
|
+
constructor({ page, neetoPlaywrightUtilities, integrationRouteIndex, }) {
|
|
7759
|
+
super({
|
|
7760
|
+
page,
|
|
7761
|
+
neetoPlaywrightUtilities,
|
|
7762
|
+
integration: "slack",
|
|
7763
|
+
integrationRouteIndex,
|
|
7764
|
+
});
|
|
7765
|
+
this.connectAndVerifyIntegration = async (redirectUrl, customSteps) => {
|
|
7766
|
+
await this.connect();
|
|
7767
|
+
await this.page
|
|
7768
|
+
.getByRole("button", {
|
|
7769
|
+
name: this.t("neetoSlack.slack.connect.loginButton"),
|
|
7770
|
+
})
|
|
7771
|
+
.click({ delay: 5000 });
|
|
7772
|
+
await this.page.waitForURL(RegExp("(.*)slack.com/.*"));
|
|
7773
|
+
const allowButton = this.page.getByRole("button", {
|
|
7774
|
+
name: SLACK_WEB_TEXTS.allow,
|
|
7775
|
+
});
|
|
7776
|
+
await test.expect(allowButton).toBeEnabled({ timeout: 20000 });
|
|
7777
|
+
const currentWorkspace = (await this.page
|
|
7778
|
+
.locator(SLACK_SELECTORS.teamPicketButtonContent)
|
|
7779
|
+
.textContent()) || "";
|
|
7780
|
+
await allowButton.click();
|
|
7781
|
+
await this.page.waitForURL(redirectUrl);
|
|
7782
|
+
await test.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({ timeout: 10000 });
|
|
7783
|
+
await test.expect(this.page.getByRole("heading", {
|
|
7784
|
+
name: this.t("neetoSlack.slack.configure.title", {
|
|
7785
|
+
teamName: currentWorkspace,
|
|
7786
|
+
}),
|
|
7787
|
+
})).toBeVisible();
|
|
7788
|
+
await test.expect(this.page.getByTestId(COMMON_SELECTORS.selectValueContainer)).toContainText(SLACK_DEFAULT_CHANNEL);
|
|
7789
|
+
await this.page
|
|
7790
|
+
.getByRole("button", { name: this.t("neetoSlack.common.continue") })
|
|
7791
|
+
.click();
|
|
7792
|
+
if (customSteps) {
|
|
7793
|
+
await customSteps();
|
|
7794
|
+
}
|
|
7795
|
+
else {
|
|
7796
|
+
await test.expect(this.page.getByRole("heading", {
|
|
7797
|
+
name: this.t("neetoSlack.slack.finish.title", {
|
|
7798
|
+
teamName: currentWorkspace,
|
|
7799
|
+
}),
|
|
7800
|
+
})).toBeVisible();
|
|
7801
|
+
await this.page
|
|
7802
|
+
.getByRole("button", { name: this.t("neetoSlack.common.done") })
|
|
7803
|
+
.click();
|
|
7804
|
+
}
|
|
7805
|
+
await this.verifyIntegrationStatus();
|
|
7806
|
+
};
|
|
7807
|
+
this.disconnectAndVerifyIntegration = async () => {
|
|
7808
|
+
await this.disconnect();
|
|
7809
|
+
await this.verifyIntegrationStatus("disconnected");
|
|
7810
|
+
};
|
|
7811
|
+
this.updateConfigureSlackChannel = async ({ newSlackChannel = "random", interceptMultipleResponsesParams = {}, }) => {
|
|
7812
|
+
await this.page.getByTestId(INTEGRATION_SELECTORS.manageButton).click();
|
|
7813
|
+
await this.page
|
|
7814
|
+
.getByRole("button", { name: this.t("neetoSlack.common.edit") })
|
|
7815
|
+
.click();
|
|
7816
|
+
await this.page.getByTestId(COMMON_SELECTORS.selectContainer).click();
|
|
7817
|
+
await this.page
|
|
7818
|
+
.getByTestId(COMMON_SELECTORS.dropdownMenu)
|
|
7819
|
+
.getByText(newSlackChannel)
|
|
7820
|
+
.click();
|
|
7821
|
+
const savePromise = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7822
|
+
times: 0,
|
|
7823
|
+
...interceptMultipleResponsesParams,
|
|
7824
|
+
});
|
|
7825
|
+
await this.page
|
|
7826
|
+
.getByRole("button", { name: this.t("neetoSlack.common.save") })
|
|
7827
|
+
.click();
|
|
7828
|
+
await savePromise;
|
|
7829
|
+
};
|
|
7830
|
+
this.loginToSlackWebapp = async (slackWebappPage) => {
|
|
7831
|
+
this.slackWebappPage = slackWebappPage;
|
|
7832
|
+
if (ramda.isNotNil(process.env.SLACK_WORKSPACE) &&
|
|
7833
|
+
ramda.isNotNil(process.env.SLACK_LOGIN_PASSWORD) &&
|
|
7834
|
+
ramda.isNotNil(process.env.SLACK_LOGIN_EMAIL)) {
|
|
7835
|
+
await slackWebappPage.goto(THIRD_PARTY_ROUTES.slack.loginWithPassword(process.env.SLACK_WORKSPACE));
|
|
7836
|
+
await slackWebappPage
|
|
7837
|
+
.locator(SLACK_SELECTORS.loginEmail)
|
|
7838
|
+
.pressSequentially(process.env.SLACK_LOGIN_EMAIL, { delay: 10 });
|
|
7839
|
+
await slackWebappPage
|
|
7840
|
+
.locator(SLACK_SELECTORS.loginPassword)
|
|
7841
|
+
.pressSequentially(process.env.SLACK_LOGIN_PASSWORD, { delay: 10 });
|
|
7842
|
+
await slackWebappPage.locator(SLACK_SELECTORS.signInButton).click();
|
|
7843
|
+
await slackWebappPage
|
|
7844
|
+
.locator(SLACK_SELECTORS.redirectOpenInBrowser)
|
|
7845
|
+
.click();
|
|
7846
|
+
}
|
|
7847
|
+
else {
|
|
7848
|
+
throw new Error("ENV variable SLACK_LOGIN_EMAIL or SLACK_LOGIN_PASSWORD or SLACK_WORKSPACE is not defined. Please add the API key to use this fixture.");
|
|
7849
|
+
}
|
|
7850
|
+
};
|
|
7851
|
+
this.logoutFromSlackWebApp = async () => {
|
|
7852
|
+
await this.slackWebappPage
|
|
7853
|
+
.locator(SLACK_SELECTORS.workspaceActionsButton)
|
|
7854
|
+
.or(this.slackWebappPage.locator(SLACK_SELECTORS.teamMenuTrigger))
|
|
7855
|
+
.click();
|
|
7856
|
+
await this.slackWebappPage
|
|
7857
|
+
.locator(SLACK_SELECTORS.menuItemButton, {
|
|
7858
|
+
hasText: SLACK_WEB_TEXTS.signOut,
|
|
7859
|
+
})
|
|
7860
|
+
.click();
|
|
7861
|
+
};
|
|
7862
|
+
this.goToSlackChannel = async (slackChannel) => {
|
|
7863
|
+
await this.slackWebappPage
|
|
7864
|
+
.locator(SLACK_SELECTORS.virtualListItem, { hasText: slackChannel })
|
|
7865
|
+
.click();
|
|
7866
|
+
};
|
|
7867
|
+
}
|
|
7868
|
+
}
|
|
7869
|
+
|
|
7661
7870
|
const WEBHOOK_SELECTORS = {
|
|
7662
7871
|
addNewWebhook: "add-new-webhook-button",
|
|
7663
7872
|
endpointInputField: "endpoint-input-field",
|
|
@@ -8107,6 +8316,40 @@ const memberUtils = {
|
|
|
8107
8316
|
deactivateMemberViaRequest,
|
|
8108
8317
|
};
|
|
8109
8318
|
|
|
8319
|
+
const assertColumnHeaderVisibility = async ({ page, columnName, shouldBeVisible, }) => {
|
|
8320
|
+
const visibilityAssertion = shouldBeVisible ? "toBeVisible" : "toBeHidden";
|
|
8321
|
+
await test.expect(page.getByRole("columnheader", { name: columnName }))[visibilityAssertion]();
|
|
8322
|
+
};
|
|
8323
|
+
const toggleColumnCheckboxAndVerifyVisibility = async ({ page, tableColumns, shouldBeChecked, }) => {
|
|
8324
|
+
await page.getByTestId(COMMON_SELECTORS.columnsDropdownButton).click();
|
|
8325
|
+
for (const columnName of tableColumns) {
|
|
8326
|
+
const checkbox = page
|
|
8327
|
+
.getByTestId(COMMON_SELECTORS.columnsDropdownContainer)
|
|
8328
|
+
.getByRole("listitem")
|
|
8329
|
+
.filter({ hasText: columnName })
|
|
8330
|
+
.getByRole("checkbox");
|
|
8331
|
+
const isCheckBoxChecked = await checkbox.isChecked();
|
|
8332
|
+
if (isCheckBoxChecked !== shouldBeChecked) {
|
|
8333
|
+
await checkbox.click();
|
|
8334
|
+
}
|
|
8335
|
+
shouldBeChecked
|
|
8336
|
+
? await test.expect(checkbox).toBeChecked()
|
|
8337
|
+
: await test.expect(checkbox).not.toBeChecked();
|
|
8338
|
+
}
|
|
8339
|
+
await page.getByTestId(COMMON_SELECTORS.columnsDropdownButton).click();
|
|
8340
|
+
for (const columnName of tableColumns) {
|
|
8341
|
+
await assertColumnHeaderVisibility({
|
|
8342
|
+
page,
|
|
8343
|
+
columnName,
|
|
8344
|
+
shouldBeVisible: shouldBeChecked,
|
|
8345
|
+
});
|
|
8346
|
+
}
|
|
8347
|
+
};
|
|
8348
|
+
const tableUtils = {
|
|
8349
|
+
assertColumnHeaderVisibility,
|
|
8350
|
+
toggleColumnCheckboxAndVerifyVisibility,
|
|
8351
|
+
};
|
|
8352
|
+
|
|
8110
8353
|
var main$2 = {exports: {}};
|
|
8111
8354
|
|
|
8112
8355
|
var name = "dotenv";
|
|
@@ -8655,6 +8898,7 @@ exports.GLOBAL_TRANSLATIONS_PATTERN = GLOBAL_TRANSLATIONS_PATTERN;
|
|
|
8655
8898
|
exports.HELP_CENTER_SELECTORS = HELP_CENTER_SELECTORS;
|
|
8656
8899
|
exports.HelpAndProfilePage = HelpAndProfilePage;
|
|
8657
8900
|
exports.IS_STAGING_ENV = IS_STAGING_ENV;
|
|
8901
|
+
exports.IntegrationBase = IntegrationBase;
|
|
8658
8902
|
exports.KEYBOARD_SHORTCUTS_SELECTORS = KEYBOARD_SHORTCUTS_SELECTORS;
|
|
8659
8903
|
exports.LOGIN_SELECTORS = LOGIN_SELECTORS;
|
|
8660
8904
|
exports.MEMBER_FORM_SELECTORS = MEMBER_FORM_SELECTORS;
|
|
@@ -8671,7 +8915,9 @@ exports.PROJECT_TRANSLATIONS_PATH = PROJECT_TRANSLATIONS_PATH;
|
|
|
8671
8915
|
exports.ROLES_SELECTORS = ROLES_SELECTORS;
|
|
8672
8916
|
exports.ROUTES = ROUTES;
|
|
8673
8917
|
exports.SIGNUP_SELECTORS = SIGNUP_SELECTORS;
|
|
8918
|
+
exports.SLACK_DEFAULT_CHANNEL = SLACK_DEFAULT_CHANNEL;
|
|
8674
8919
|
exports.STORAGE_STATE = STORAGE_STATE;
|
|
8920
|
+
exports.SlackPage = SlackPage;
|
|
8675
8921
|
exports.TAGS_SELECTORS = TAGS_SELECTORS;
|
|
8676
8922
|
exports.THIRD_PARTY_ROUTES = THIRD_PARTY_ROUTES;
|
|
8677
8923
|
exports.USER_AGENTS = USER_AGENTS;
|
|
@@ -8694,6 +8940,7 @@ exports.readFileSyncIfExists = readFileSyncIfExists;
|
|
|
8694
8940
|
exports.removeCredentialFile = removeCredentialFile;
|
|
8695
8941
|
exports.shouldSkipSetupAndTeardown = shouldSkipSetupAndTeardown;
|
|
8696
8942
|
exports.skipTest = skipTest;
|
|
8943
|
+
exports.tableUtils = tableUtils;
|
|
8697
8944
|
exports.updateCredentials = updateCredentials;
|
|
8698
8945
|
exports.writeDataToFile = writeDataToFile;
|
|
8699
8946
|
//# sourceMappingURL=index.cjs.js.map
|