@globisnv/cypress-core 2.0.0 → 2.1.1
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/dist/commands/GLO_commands.d.ts +18 -4
- package/dist/commands/GLO_commands.js +37 -12
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -150,6 +150,20 @@ declare global {
|
|
|
150
150
|
* @example - cy.GLO_clickDatacontrolViewerButton('salesorder', 'btnAdd');
|
|
151
151
|
*/
|
|
152
152
|
GLO_clickDatacontrolViewerButton(pageName: string, buttonName: baseDatacontrolViewerButtonType, skipCheck?: skipCheckFlag): void;
|
|
153
|
+
/**
|
|
154
|
+
* Command to check the counter badges of a button within the main program datacontrol bar.
|
|
155
|
+
*
|
|
156
|
+
* The grey badge counts the attachments with a physical file or the closed notifications, the red badge the
|
|
157
|
+
* attachments without a physical file or the open notifications. A badge is hidden at 0, so passing 0 checks that it does not exist.
|
|
158
|
+
*
|
|
159
|
+
* @param {datacontrolCounterButtonType} buttonName - The datacontrol button with the counters.
|
|
160
|
+
* @param {number} greyCount - The expected grey count, 0 when there should be no grey badge.
|
|
161
|
+
* @param {number} redCount - The expected red count, 0 when there should be no red badge.
|
|
162
|
+
* @param {number} [timeOut = defaultTimeout] - The time to wait for the counters to update.
|
|
163
|
+
*
|
|
164
|
+
* @example - cy.GLO_checkDatacontrolCounter('btnAttachment', 3, 1);
|
|
165
|
+
*/
|
|
166
|
+
GLO_checkDatacontrolCounter(buttonName: datacontrolCounterButtonType, greyCount: number, redCount: number, timeOut?: number): void;
|
|
153
167
|
/**
|
|
154
168
|
* Command to click a button based on its displayed text.
|
|
155
169
|
*
|
|
@@ -193,16 +207,16 @@ declare global {
|
|
|
193
207
|
/**
|
|
194
208
|
* Command to open the workflow menu and to click a desired workflow in the main program datacontrol section.
|
|
195
209
|
*
|
|
196
|
-
* @param {string} buttonName - The workflow entry to be selected.
|
|
197
|
-
* @param {exactMatchFlag} [exactMatch] -
|
|
210
|
+
* @param {string} buttonName - The workflow entry to be selected. An entry with exactly this text is preferred over entries that only contain it.
|
|
211
|
+
* @param {exactMatchFlag} [exactMatch] - Only accept an exact match (equalBool). Default: disabled, falls back to the first entry containing the text when no entry matches exactly.
|
|
198
212
|
*/
|
|
199
213
|
GLO_selectMenuButton(buttonName: string, exactMatch?: exactMatchFlag): void;
|
|
200
214
|
/**
|
|
201
215
|
* Command to open the workflow menu and to click a desired workflow in the datacontrol viewer section.
|
|
202
216
|
*
|
|
203
217
|
* @param {string} tabName - The name of the tab containing the datacontrol viewer section.
|
|
204
|
-
* @param {string} buttonName - The workflow entry to be selected.
|
|
205
|
-
* @param {exactMatchFlag} [exactMatch] -
|
|
218
|
+
* @param {string} buttonName - The workflow entry to be selected. An entry with exactly this text is preferred over entries that only contain it.
|
|
219
|
+
* @param {exactMatchFlag} [exactMatch] - Only accept an exact match (equalBool). Default: disabled, falls back to the first entry containing the text when no entry matches exactly.
|
|
206
220
|
*
|
|
207
221
|
* @example - cy.GLO_selectMenuButtonControlView('salesorder', 'Confirm');
|
|
208
222
|
*/
|
|
@@ -472,6 +472,17 @@ Cypress.Commands.add('GLO_clickDatacontrolViewerButton', (pageName, buttonName,
|
|
|
472
472
|
cy.GLO_getElement([`ng$${pageName}_tab`, 'datacontrol_viewer']).find('[title="Save record"][disabled="true"]', { timeout: 60000 });
|
|
473
473
|
});
|
|
474
474
|
});
|
|
475
|
+
Cypress.Commands.add('GLO_checkDatacontrolCounter', (buttonName, greyCount, redCount, timeOut = defaultTimeout) => {
|
|
476
|
+
const button = () => cy.get(`globiscomponents-data-control[name="datacontrol"]:visible [id="${buttonName}"]`, { timeout: timeOut });
|
|
477
|
+
button().should('exist');
|
|
478
|
+
const checkBadge = (selector, count) => {
|
|
479
|
+
button()
|
|
480
|
+
.find(selector, { timeout: timeOut })
|
|
481
|
+
.should(count > 0 ? 'have.text' : 'not.exist', ...(count > 0 ? [count.toString()] : []));
|
|
482
|
+
};
|
|
483
|
+
checkBadge('[counter-muted]', greyCount);
|
|
484
|
+
checkBadge('[counter]:not([counter-muted])', redCount);
|
|
485
|
+
});
|
|
475
486
|
Cypress.Commands.add('GLO_selectCompany', (companyName) => {
|
|
476
487
|
cy.GLO_addInput(['ng2$svy_nav_login', 'company'], companyName);
|
|
477
488
|
cy.get('[data-cy="ng2$svy_nav_login.btnLogin"]').click();
|
|
@@ -732,27 +743,41 @@ Cypress.Commands.add('GLO_selectTab', (selector, tabName, openOrClose) => {
|
|
|
732
743
|
}
|
|
733
744
|
});
|
|
734
745
|
});
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
746
|
+
// True when the workflow menu has an entry whose text equals the button text.
|
|
747
|
+
const checkForExactMatch = ($menu, exactText) => $menu
|
|
748
|
+
.find('.dx-menu-item-text')
|
|
749
|
+
.toArray()
|
|
750
|
+
.some((element) => exactText.test(element.textContent ?? ''));
|
|
751
|
+
// Clicks a workflow entry in the open workflow menu. An entry whose text equals buttonName wins over entries
|
|
752
|
+
// that only contain it (e.g. 'Confirm' over a 'Confirm with discrepancies - ...' status change listed above it);
|
|
753
|
+
// without an exact entry it falls back to the first entry containing buttonName, unless exactMatch is set.
|
|
754
|
+
// The choice is made inside .filter(), a query that Cypress retries on the live menu, so it is never decided on a
|
|
755
|
+
// menu that is still rendering or on a snapshot of it.
|
|
756
|
+
const clickWorkflowMenuItem = (buttonName, exactMatch) => {
|
|
757
|
+
const exactText = new RegExp(`^\\s*${Cypress._.escapeRegExp(buttonName)}\\s*$`);
|
|
738
758
|
cy.GLO_getVisible('.dx-submenu', 10000)
|
|
739
|
-
.
|
|
759
|
+
.find('.dx-menu-item-text')
|
|
760
|
+
.filter((_index, element) => {
|
|
761
|
+
const text = element.textContent ?? '';
|
|
762
|
+
if (exactMatch || checkForExactMatch(Cypress.$(element).closest('.dx-submenu'), exactText)) {
|
|
763
|
+
return exactText.test(text);
|
|
764
|
+
}
|
|
765
|
+
return text.includes(buttonName);
|
|
766
|
+
})
|
|
767
|
+
.first()
|
|
740
768
|
.click()
|
|
741
769
|
.then(() => {
|
|
742
770
|
cy.GLO_checkLoadingIndicator();
|
|
743
771
|
});
|
|
744
772
|
cy.GLO_log(` - Used workflow button '${buttonName}'`);
|
|
773
|
+
};
|
|
774
|
+
Cypress.Commands.add('GLO_selectMenuButton', (buttonName, exactMatch = noEqualBool) => {
|
|
775
|
+
cy.GLO_clickDatacontrolBrowserButton('btnMenu');
|
|
776
|
+
clickWorkflowMenuItem(buttonName, exactMatch);
|
|
745
777
|
});
|
|
746
778
|
Cypress.Commands.add('GLO_selectMenuButtonControlView', (tabName, buttonName, exactMatch = noEqualBool) => {
|
|
747
|
-
const searchParam = exactMatch ? new RegExp(`^\\s*${Cypress._.escapeRegExp(buttonName)}\\s*$`) : buttonName;
|
|
748
779
|
cy.GLO_clickDatacontrolViewerButton(tabName, 'btnMenu');
|
|
749
|
-
|
|
750
|
-
.contains(searchParam)
|
|
751
|
-
.click()
|
|
752
|
-
.then(() => {
|
|
753
|
-
cy.GLO_checkLoadingIndicator();
|
|
754
|
-
});
|
|
755
|
-
cy.GLO_log(` - Used workflow button '${buttonName}'`);
|
|
780
|
+
clickWorkflowMenuItem(buttonName, exactMatch);
|
|
756
781
|
});
|
|
757
782
|
const navItem = (topBottom, programName, tabNumber, mode) => {
|
|
758
783
|
if (topBottom !== top && topBottom !== bottom)
|
package/dist/types.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ type customValueTypeUndefined = customValueType | undefined;
|
|
|
11
11
|
type deleteRecordsType = 'DELETE_CYPRESS_RECORDS' | 'DELETE_LEAPWORK_RECORDS';
|
|
12
12
|
type viewModeButtonType = 'btnList' | 'btnDetail';
|
|
13
13
|
type datacontrolbuttonType = baseDatacontrolViewerButtonType | viewModeButtonType | 'btnPrev' | 'btnNext' | 'btnAll' | 'btnPivot' | 'btnAttachment' | 'btnAddMode' | 'btnEditMode' | 'btnDeleteMode' | 'btnDeeplink' | 'btnExtendedSearch' | 'btnCustomViews' | 'btnFilter' | 'btnClearAllFilters';
|
|
14
|
+
type datacontrolCounterButtonType = 'btnAttachment' | 'btnNotification';
|
|
14
15
|
type checkValueInGridType = string | string[] | number;
|
|
15
16
|
type selectMenuButtonLeftType = 'home' | 'settings' | 'help' | 'support' | 'excel' | 'info' | 'refresh' | 'query' | 'clients' | 'users' | 'theme';
|
|
16
17
|
type urlTypeType = 'online' | 'pos' | 'globgate' | 'globjob' | 'globscan' | 'portal' | 'carrier' | 'globtrace' | 'external_portal' | 'globtake' | 'globis_external_portal';
|