@bigbinary/neeto-playwright-commons 1.9.0 → 1.9.2
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 +38 -24
- package/index.cjs.js.map +1 -1
- package/index.d.ts +34 -5
- package/index.js +38 -24
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -42,8 +42,7 @@ interface ApiRequestProps {
|
|
|
42
42
|
params?: ParamProps;
|
|
43
43
|
}
|
|
44
44
|
interface WaitForPageLoadParams {
|
|
45
|
-
|
|
46
|
-
retryTimeout: number;
|
|
45
|
+
visibilityTimeout: number;
|
|
47
46
|
customPageContext: Page | undefined;
|
|
48
47
|
}
|
|
49
48
|
type ApiRequest = (props: ApiRequestProps & Record<string, unknown>) => Promise<APIResponse | undefined>;
|
|
@@ -57,11 +56,17 @@ interface SelectOptionFromDropdownParams {
|
|
|
57
56
|
selectMenu: string;
|
|
58
57
|
value: string;
|
|
59
58
|
options?: Partial<{
|
|
60
|
-
|
|
59
|
+
visibilityTimeout: number;
|
|
61
60
|
textAssertionTimeout: number;
|
|
62
61
|
retryTimeout: number;
|
|
63
62
|
}>;
|
|
64
63
|
}
|
|
64
|
+
interface SearchAndVerifyProps {
|
|
65
|
+
searchTerm: string;
|
|
66
|
+
countSelector: string;
|
|
67
|
+
searchInputSelector?: string;
|
|
68
|
+
countText: string;
|
|
69
|
+
}
|
|
65
70
|
declare class CustomCommands {
|
|
66
71
|
page: Page;
|
|
67
72
|
responses: string[];
|
|
@@ -146,9 +151,9 @@ declare class CustomCommands {
|
|
|
146
151
|
*/
|
|
147
152
|
reloadAndWait: (requestCount: number, customPageContext?: Page, interceptMultipleResponsesProps?: Partial<Omit<InterceptMultipleResponsesParams, "times">>) => Promise<void>;
|
|
148
153
|
waitForPageLoad: ({
|
|
149
|
-
|
|
154
|
+
visibilityTimeout,
|
|
150
155
|
customPageContext
|
|
151
|
-
}
|
|
156
|
+
}?: Partial<WaitForPageLoadParams>) => Promise<void>;
|
|
152
157
|
/**
|
|
153
158
|
*
|
|
154
159
|
* Command to send a request.
|
|
@@ -197,6 +202,26 @@ declare class CustomCommands {
|
|
|
197
202
|
* @endexample
|
|
198
203
|
*/
|
|
199
204
|
verifyFieldValue: VerifyFieldValue;
|
|
205
|
+
/**
|
|
206
|
+
*
|
|
207
|
+
* Command to search for a term and verify the results and its count.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
*
|
|
211
|
+
* await neetoPlaywrightUtilities.searchAndVerify({
|
|
212
|
+
* searchTerm: "searchTerm",
|
|
213
|
+
* searchInputSelector: COMMON_SELECTORS.inputField,
|
|
214
|
+
* countSelector: COMMON_SELECTORS.count,
|
|
215
|
+
* countText: "43 items",
|
|
216
|
+
* });
|
|
217
|
+
* @endexample
|
|
218
|
+
*/
|
|
219
|
+
searchAndVerify: ({
|
|
220
|
+
searchTerm,
|
|
221
|
+
searchInputSelector,
|
|
222
|
+
countSelector,
|
|
223
|
+
countText
|
|
224
|
+
}: SearchAndVerifyProps) => Promise<void>;
|
|
200
225
|
}
|
|
201
226
|
interface EmailContentParams {
|
|
202
227
|
email: string;
|
|
@@ -776,6 +801,9 @@ declare const networkConditions: Record<"Slow 3G" | "Fast 3G" | "No Throttling",
|
|
|
776
801
|
* @endexample
|
|
777
802
|
*/
|
|
778
803
|
declare const COMMON_SELECTORS: {
|
|
804
|
+
emailInputError: string;
|
|
805
|
+
pane: string;
|
|
806
|
+
sideBar: string;
|
|
779
807
|
copyButton: string;
|
|
780
808
|
spinner: string;
|
|
781
809
|
subheaderText: string;
|
|
@@ -882,6 +910,7 @@ declare const NEETO_FILTERS_SELECTORS: {
|
|
|
882
910
|
allMenubarBlock: string;
|
|
883
911
|
filtersEmailFilter: string;
|
|
884
912
|
paneModalCrossIcon: string;
|
|
913
|
+
searchTermBlock: string;
|
|
885
914
|
};
|
|
886
915
|
declare const HELP_CENTER_SELECTORS: {
|
|
887
916
|
helpButton: string;
|
package/index.js
CHANGED
|
@@ -26,6 +26,25 @@ import require$$1$2 from 'string_decoder';
|
|
|
26
26
|
import require$$4$1 from 'timers';
|
|
27
27
|
import require$$3$2 from 'crypto';
|
|
28
28
|
|
|
29
|
+
const NEETO_FILTERS_SELECTORS = {
|
|
30
|
+
emailSelectContainer: "email-select-container-wrapper",
|
|
31
|
+
filterPaneHeading: "neeto-filters-pane-header",
|
|
32
|
+
neetoFiltersEmailBlock: "neeto-filters-email-block",
|
|
33
|
+
neetoFiltersRoleBlock: "neeto-filters-role-block",
|
|
34
|
+
neetoFiltersBarClearButton: "neeto-filters-bar-clear-btn",
|
|
35
|
+
neetoFiltersNameFilterField: "neeto-filters-name-filter",
|
|
36
|
+
neetoFilterNameBlock: "neeto-filters-name-block",
|
|
37
|
+
roleSelectContainer: "role-select-container-wrapper",
|
|
38
|
+
filterButton: "neeto-filters-toggle-btn",
|
|
39
|
+
filtersClearButton: "neeto-filters-clear-btn",
|
|
40
|
+
filterDoneButton: "neeto-filters-done-btn",
|
|
41
|
+
filteredMembersCount: "ntm-filtered-members-count",
|
|
42
|
+
allMenubarBlock: "ntm-members-menubar-all-block",
|
|
43
|
+
filtersEmailFilter: "neeto-filters-email-filter",
|
|
44
|
+
paneModalCrossIcon: "neeto-filters-close-button",
|
|
45
|
+
searchTermBlock: "neeto-filters-search-term-block",
|
|
46
|
+
};
|
|
47
|
+
|
|
29
48
|
const ENVIRONMENT = {
|
|
30
49
|
development: "development",
|
|
31
50
|
staging: "staging",
|
|
@@ -139,6 +158,9 @@ const getByDataQA = curry((page, dataQa) => {
|
|
|
139
158
|
});
|
|
140
159
|
|
|
141
160
|
const COMMON_SELECTORS = {
|
|
161
|
+
emailInputError: "email-input-error",
|
|
162
|
+
pane: "pane-wrapper",
|
|
163
|
+
sideBar: "sidebar",
|
|
142
164
|
copyButton: "copy-button",
|
|
143
165
|
spinner: ".neeto-ui-spinner",
|
|
144
166
|
subheaderText: "subheader-left",
|
|
@@ -2532,15 +2554,15 @@ class CustomCommands {
|
|
|
2532
2554
|
await pageContext.reload();
|
|
2533
2555
|
await reloadRequests;
|
|
2534
2556
|
};
|
|
2535
|
-
this.waitForPageLoad = async ({
|
|
2557
|
+
this.waitForPageLoad = async ({ visibilityTimeout = 35000, customPageContext, } = {}) => {
|
|
2536
2558
|
const pageContext = customPageContext !== null && customPageContext !== void 0 ? customPageContext : this.page;
|
|
2537
2559
|
await pageContext.waitForLoadState("load");
|
|
2538
2560
|
await Promise.all([
|
|
2539
2561
|
expect(pageContext.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({
|
|
2540
|
-
timeout:
|
|
2562
|
+
timeout: visibilityTimeout,
|
|
2541
2563
|
}),
|
|
2542
2564
|
expect(pageContext.getByTestId(COMMON_SELECTORS.spinner)).toBeHidden({
|
|
2543
|
-
timeout:
|
|
2565
|
+
timeout: visibilityTimeout,
|
|
2544
2566
|
}),
|
|
2545
2567
|
]);
|
|
2546
2568
|
};
|
|
@@ -2567,14 +2589,14 @@ class CustomCommands {
|
|
|
2567
2589
|
};
|
|
2568
2590
|
this.selectOptionFromDropdown = async ({ selectValueContainer, selectMenu, value, options = {}, }) => {
|
|
2569
2591
|
Object.assign({
|
|
2570
|
-
|
|
2592
|
+
visibilityTimeout: 2000,
|
|
2571
2593
|
textAssertionTimeout: 1000,
|
|
2572
2594
|
retryTimeout: 20000,
|
|
2573
2595
|
}, options);
|
|
2574
2596
|
await expect(async () => {
|
|
2575
2597
|
await this.page.getByTestId(selectValueContainer).click();
|
|
2576
2598
|
await expect(this.page.getByTestId(selectMenu)).toBeVisible({
|
|
2577
|
-
timeout: options.
|
|
2599
|
+
timeout: options.visibilityTimeout,
|
|
2578
2600
|
});
|
|
2579
2601
|
await this.page.getByTestId(selectMenu).getByText(value).click();
|
|
2580
2602
|
await expect(this.page.getByTestId(selectValueContainer)).toContainText(value, { timeout: options.textAssertionTimeout });
|
|
@@ -2586,6 +2608,16 @@ class CustomCommands {
|
|
|
2586
2608
|
? Promise.all(values.map(value => verifyEachFieldValue(value)))
|
|
2587
2609
|
: verifyEachFieldValue(values);
|
|
2588
2610
|
};
|
|
2611
|
+
this.searchAndVerify = async ({ searchTerm, searchInputSelector = COMMON_SELECTORS.inputField, countSelector, countText, }) => {
|
|
2612
|
+
await expect(async () => {
|
|
2613
|
+
await this.page.getByTestId(searchInputSelector).fill(searchTerm);
|
|
2614
|
+
await expect(this.page.getByTestId(NEETO_FILTERS_SELECTORS.searchTermBlock)).toBeVisible();
|
|
2615
|
+
await this.page.reload({ waitUntil: "load" });
|
|
2616
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({ timeout: 10000 });
|
|
2617
|
+
await expect(this.page.getByRole("cell", { name: searchTerm })).toBeVisible();
|
|
2618
|
+
await expect(this.page.getByTestId(countSelector)).toContainText(countText);
|
|
2619
|
+
}).toPass({ timeout: 15000 });
|
|
2620
|
+
};
|
|
2589
2621
|
this.page = page;
|
|
2590
2622
|
this.responses = [];
|
|
2591
2623
|
this.request = request;
|
|
@@ -13776,24 +13808,6 @@ const NEETO_EDITOR_SELECTORS = {
|
|
|
13776
13808
|
submitLinkButton: "neeto-editor-add-link",
|
|
13777
13809
|
};
|
|
13778
13810
|
|
|
13779
|
-
const NEETO_FILTERS_SELECTORS = {
|
|
13780
|
-
emailSelectContainer: "email-select-container-wrapper",
|
|
13781
|
-
filterPaneHeading: "neeto-filters-pane-header",
|
|
13782
|
-
neetoFiltersEmailBlock: "neeto-filters-email-block",
|
|
13783
|
-
neetoFiltersRoleBlock: "neeto-filters-role-block",
|
|
13784
|
-
neetoFiltersBarClearButton: "neeto-filters-bar-clear-btn",
|
|
13785
|
-
neetoFiltersNameFilterField: "neeto-filters-name-filter",
|
|
13786
|
-
neetoFilterNameBlock: "neeto-filters-name-block",
|
|
13787
|
-
roleSelectContainer: "role-select-container-wrapper",
|
|
13788
|
-
filterButton: "neeto-filters-toggle-btn",
|
|
13789
|
-
filtersClearButton: "neeto-filters-clear-btn",
|
|
13790
|
-
filterDoneButton: "neeto-filters-done-btn",
|
|
13791
|
-
filteredMembersCount: "ntm-filtered-members-count",
|
|
13792
|
-
allMenubarBlock: "ntm-members-menubar-all-block",
|
|
13793
|
-
filtersEmailFilter: "neeto-filters-email-filter",
|
|
13794
|
-
paneModalCrossIcon: "neeto-filters-close-button",
|
|
13795
|
-
};
|
|
13796
|
-
|
|
13797
13811
|
const MEMBER_SELECTORS = {
|
|
13798
13812
|
membersTab: "members-nav-tab",
|
|
13799
13813
|
newButton: "ntm-add-member-button",
|
|
@@ -13844,7 +13858,7 @@ const ROLES_SELECTORS = {
|
|
|
13844
13858
|
tableHeaderRoleTitle: "ntm-roles-table-header-role-title",
|
|
13845
13859
|
permissionCheckbox: "ntm-roles-permission-checkbox",
|
|
13846
13860
|
editRoleButton: "ntm-roles-table-edit-role-button",
|
|
13847
|
-
deleteRoleButton: "
|
|
13861
|
+
deleteRoleButton: "ntm-roles-table-delete-role-button",
|
|
13848
13862
|
permissionCard: "ntm-roles-permission-card",
|
|
13849
13863
|
};
|
|
13850
13864
|
|