@globisnv/cypress-core 2.1.0 → 2.1.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/dist/blueprints/GLO_enterCountry.d.ts +1 -0
- package/dist/blueprints/GLO_enterCountry.js +1 -0
- package/dist/blueprints/GLO_postalcode.d.ts +1 -0
- package/dist/blueprints/GLO_postalcode.js +7 -1
- package/dist/commands/GLO_commands.d.ts +4 -4
- package/dist/commands/GLO_commands.js +59 -28
- package/package.json +1 -1
|
@@ -32,6 +32,7 @@ export const GLO_enterCountry = (obj, part = 'country') => {
|
|
|
32
32
|
cy.GLO_checkbox([formName, 'checkbox_use_states'], obj.useStates);
|
|
33
33
|
cy.GLO_addInput([formName, 'street_format'], obj.streetFormat);
|
|
34
34
|
cy.GLO_addInput([formName, 'textbox_addres_block_format'], obj.addressBlockFormat);
|
|
35
|
+
cy.GLO_addInput([formName, 'timezone'], obj.timezone);
|
|
35
36
|
cy.GLO_selectTab([formName, 'tabs_70'], 'Translations', open);
|
|
36
37
|
if (obj.translation !== undefined) {
|
|
37
38
|
cy.GLO_getElement(['ng$basetabletranslation_uuid_lst_tab', 'grid']).within(() => {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export const GLO_enterPostalcode = (obj) => {
|
|
2
2
|
const formName = 'ng$postalcode_dtl';
|
|
3
|
-
|
|
3
|
+
if (obj.country) {
|
|
4
|
+
cy.GLO_addInput([formName, 'country_id'], obj.country);
|
|
5
|
+
// The country's server-side change sets the time zone; wait for it so it cannot overwrite a typed one
|
|
6
|
+
cy.GLO_checkLoadingIndicator();
|
|
7
|
+
}
|
|
4
8
|
cy.GLO_addInput([formName, 'city'], obj.city);
|
|
5
9
|
cy.GLO_addInput([formName, 'postalcode'], obj.PC);
|
|
10
|
+
// After the country, see above
|
|
11
|
+
cy.GLO_addInput([formName, 'timezone'], obj.timezone);
|
|
6
12
|
};
|
|
@@ -207,16 +207,16 @@ declare global {
|
|
|
207
207
|
/**
|
|
208
208
|
* Command to open the workflow menu and to click a desired workflow in the main program datacontrol section.
|
|
209
209
|
*
|
|
210
|
-
* @param {string} buttonName - The workflow entry to be selected.
|
|
211
|
-
* @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.
|
|
212
212
|
*/
|
|
213
213
|
GLO_selectMenuButton(buttonName: string, exactMatch?: exactMatchFlag): void;
|
|
214
214
|
/**
|
|
215
215
|
* Command to open the workflow menu and to click a desired workflow in the datacontrol viewer section.
|
|
216
216
|
*
|
|
217
217
|
* @param {string} tabName - The name of the tab containing the datacontrol viewer section.
|
|
218
|
-
* @param {string} buttonName - The workflow entry to be selected.
|
|
219
|
-
* @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.
|
|
220
220
|
*
|
|
221
221
|
* @example - cy.GLO_selectMenuButtonControlView('salesorder', 'Confirm');
|
|
222
222
|
*/
|
|
@@ -473,19 +473,15 @@ Cypress.Commands.add('GLO_clickDatacontrolViewerButton', (pageName, buttonName,
|
|
|
473
473
|
});
|
|
474
474
|
});
|
|
475
475
|
Cypress.Commands.add('GLO_checkDatacontrolCounter', (buttonName, greyCount, redCount, timeOut = defaultTimeout) => {
|
|
476
|
-
const button = `globiscomponents-data-control[name="datacontrol"]:visible
|
|
477
|
-
|
|
478
|
-
cy.get(button, { timeout: timeOut }).should('exist');
|
|
476
|
+
const button = () => cy.get(`globiscomponents-data-control[name="datacontrol"]:visible [id="${buttonName}"]`, { timeout: timeOut });
|
|
477
|
+
button().should('exist');
|
|
479
478
|
const checkBadge = (selector, count) => {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
else {
|
|
484
|
-
cy.get(selector, { timeout: timeOut }).should('not.exist');
|
|
485
|
-
}
|
|
479
|
+
button()
|
|
480
|
+
.find(selector, { timeout: timeOut })
|
|
481
|
+
.should(count > 0 ? 'have.text' : 'not.exist', ...(count > 0 ? [count.toString()] : []));
|
|
486
482
|
};
|
|
487
|
-
checkBadge(
|
|
488
|
-
checkBadge(
|
|
483
|
+
checkBadge('[counter-muted]', greyCount);
|
|
484
|
+
checkBadge('[counter]:not([counter-muted])', redCount);
|
|
489
485
|
});
|
|
490
486
|
Cypress.Commands.add('GLO_selectCompany', (companyName) => {
|
|
491
487
|
cy.GLO_addInput(['ng2$svy_nav_login', 'company'], companyName);
|
|
@@ -747,27 +743,41 @@ Cypress.Commands.add('GLO_selectTab', (selector, tabName, openOrClose) => {
|
|
|
747
743
|
}
|
|
748
744
|
});
|
|
749
745
|
});
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
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*$`);
|
|
753
758
|
cy.GLO_getVisible('.dx-submenu', 10000)
|
|
754
|
-
.
|
|
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()
|
|
755
768
|
.click()
|
|
756
769
|
.then(() => {
|
|
757
770
|
cy.GLO_checkLoadingIndicator();
|
|
758
771
|
});
|
|
759
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);
|
|
760
777
|
});
|
|
761
778
|
Cypress.Commands.add('GLO_selectMenuButtonControlView', (tabName, buttonName, exactMatch = noEqualBool) => {
|
|
762
|
-
const searchParam = exactMatch ? new RegExp(`^\\s*${Cypress._.escapeRegExp(buttonName)}\\s*$`) : buttonName;
|
|
763
779
|
cy.GLO_clickDatacontrolViewerButton(tabName, 'btnMenu');
|
|
764
|
-
|
|
765
|
-
.contains(searchParam)
|
|
766
|
-
.click()
|
|
767
|
-
.then(() => {
|
|
768
|
-
cy.GLO_checkLoadingIndicator();
|
|
769
|
-
});
|
|
770
|
-
cy.GLO_log(` - Used workflow button '${buttonName}'`);
|
|
780
|
+
clickWorkflowMenuItem(buttonName, exactMatch);
|
|
771
781
|
});
|
|
772
782
|
const navItem = (topBottom, programName, tabNumber, mode) => {
|
|
773
783
|
if (topBottom !== top && topBottom !== bottom)
|
|
@@ -2253,9 +2263,18 @@ Cypress.Commands.add('GLO_extendedFilter', (filter, clearExistingFilters) => {
|
|
|
2253
2263
|
if (value === 'Select All')
|
|
2254
2264
|
return;
|
|
2255
2265
|
filterComponent()
|
|
2256
|
-
.find(
|
|
2257
|
-
.
|
|
2258
|
-
|
|
2266
|
+
.find(getFilterFieldSelector(path, dropDownType, clauseType, false))
|
|
2267
|
+
.then(($field) => {
|
|
2268
|
+
// A tag box adds a tag, a select box (single valuelist) shows the value in its input.
|
|
2269
|
+
// A tag box is a select box too (it carries both classes), so test for the tag box.
|
|
2270
|
+
if ($field.hasClass('dx-tagbox'))
|
|
2271
|
+
cy.wrap($field)
|
|
2272
|
+
.find('.dx-tag')
|
|
2273
|
+
.filter((_, el) => (el.getAttribute('aria-label') ?? '').includes(value))
|
|
2274
|
+
.should('have.length.greaterThan', 0);
|
|
2275
|
+
else
|
|
2276
|
+
cy.wrap($field).find('.dx-texteditor-input').should('have.value', value);
|
|
2277
|
+
});
|
|
2259
2278
|
break;
|
|
2260
2279
|
case 'field':
|
|
2261
2280
|
case 'logical-operator':
|
|
@@ -2335,13 +2354,25 @@ Cypress.Commands.add('GLO_extendedFilter', (filter, clearExistingFilters) => {
|
|
|
2335
2354
|
});
|
|
2336
2355
|
return;
|
|
2337
2356
|
case '=':
|
|
2338
|
-
// biome-ignore lint/suspicious/noFallthroughSwitchClause: intentional - falls through to the shared date/time handling below when v isn't check/uncheck
|
|
2339
2357
|
case '≠':
|
|
2340
2358
|
if (v === check || v === unCheck) {
|
|
2341
2359
|
checkBox(path, v);
|
|
2342
2360
|
return;
|
|
2343
2361
|
}
|
|
2344
|
-
|
|
2362
|
+
// A single-valuelist field is a select box, which ignores a typed value on enter. Typing searches
|
|
2363
|
+
// its list, which renders only a page of items, so the value is typed first and then picked.
|
|
2364
|
+
filterComponent()
|
|
2365
|
+
.find(getFilterFieldSelector(path, 'value', undefined, false))
|
|
2366
|
+
.then(($field) => {
|
|
2367
|
+
const input = () => cy.wrap($field).find('.dx-texteditor-input');
|
|
2368
|
+
if ($field.hasClass('dx-selectbox')) {
|
|
2369
|
+
input().type(`{selectall}{del}${v}`).should('have.attr', 'aria-controls');
|
|
2370
|
+
dropDown(path, clauseType, 'value', String(v));
|
|
2371
|
+
}
|
|
2372
|
+
else
|
|
2373
|
+
input().type(`{selectall}{del}${v}{enter}`);
|
|
2374
|
+
});
|
|
2375
|
+
return;
|
|
2345
2376
|
case 'before':
|
|
2346
2377
|
case 'after':
|
|
2347
2378
|
case 'contains':
|