@globisnv/cypress-core 2.2.0 → 2.3.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/blueprints/GLO_consignment.js +4 -0
- package/dist/blueprints/GLO_consignmentType.d.ts +16 -0
- package/dist/blueprints/GLO_consignmentType.js +40 -0
- package/dist/blueprints/GLO_logisticContractDetail.d.ts +8 -0
- package/dist/blueprints/GLO_logisticContractDetail.js +19 -1
- package/dist/commands/GLO_commands.d.ts +4 -4
- package/dist/commands/GLO_commands.js +14 -3
- package/package.json +1 -1
|
@@ -25,6 +25,10 @@ export const GLO_enterConsignment = (obj, formName = defaultFormName, formNameGe
|
|
|
25
25
|
cy.GLO_validateCheckbox([formName, 'flag_spot'], obj.flagSpotOrder);
|
|
26
26
|
cy.GLO_addInput([formName, 'plan_bloc'], obj.planBloc);
|
|
27
27
|
cy.GLO_addInput([formName, 'file_reference_txt'], obj.fileReference);
|
|
28
|
+
if (obj.equipmentType) {
|
|
29
|
+
cy.GLO_addInput([formName, 'equipment_type_id'], obj.equipmentType);
|
|
30
|
+
cy.GLO_checkLoadingIndicator();
|
|
31
|
+
}
|
|
28
32
|
if (obj.collectionAddress || obj.deliveryAddress || obj.loadStartBooked || obj.loadEndBooked || obj.loadStartBookedTime || obj.loadEndBookedTime) {
|
|
29
33
|
cy.GLO_selectTab([formName, 'tabs_70'], 'General', open);
|
|
30
34
|
if (obj.collectionAddress) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CheckState } from '../tsHelper.js';
|
|
2
|
+
export type objConsignmentType = {
|
|
3
|
+
code?: string;
|
|
4
|
+
flagLinkContractDetailRequired?: CheckState;
|
|
5
|
+
lcdSearchFields?: string[];
|
|
6
|
+
translation?: string;
|
|
7
|
+
};
|
|
8
|
+
export type objConsignmentSubtype = {
|
|
9
|
+
code?: string;
|
|
10
|
+
flagShipmentIn?: CheckState;
|
|
11
|
+
flagShipmentOut?: CheckState;
|
|
12
|
+
flagRequirePlanBloc?: CheckState;
|
|
13
|
+
translation?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const GLO_enterConsignmentType: (obj: objConsignmentType) => void;
|
|
16
|
+
export declare const GLO_enterConsignmentSubtype: (obj: objConsignmentSubtype) => void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { close, open } from '../tsHelper.js';
|
|
2
|
+
// The description of every language in the Translations tab gets the same text
|
|
3
|
+
const enterTranslations = (formName, translation) => {
|
|
4
|
+
if (translation) {
|
|
5
|
+
cy.GLO_selectTab([formName, 'tabs_70'], 'Translations', open);
|
|
6
|
+
cy.GLO_getElement([formName, 'tabs_70']).within(() => {
|
|
7
|
+
cy.get('.editable-field').each((field) => {
|
|
8
|
+
cy.wrap(field).dblclick().type(translation);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
cy.GLO_selectTab([formName, 'tabs_70'], 'Translations', close);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export const GLO_enterConsignmentType = (obj) => {
|
|
15
|
+
const formName = 'ng$consignment_type_dtl';
|
|
16
|
+
cy.GLO_addInput([formName, 'consignment_type_code'], obj.code);
|
|
17
|
+
cy.GLO_checkbox([formName, 'flag_link_contract_detail_required'], obj.flagLinkContractDetailRequired);
|
|
18
|
+
// LCD search fields is a multi-select list: exactly the items named are selected, the others are cleared
|
|
19
|
+
if (obj.lcdSearchFields) {
|
|
20
|
+
const wanted = obj.lcdSearchFields;
|
|
21
|
+
cy.GLO_getElement([formName, 'lcd_search_fields'])
|
|
22
|
+
.find('.dx-list-item')
|
|
23
|
+
.each(($item) => {
|
|
24
|
+
const text = $item.find('.dx-list-item-content').text().trim();
|
|
25
|
+
if (text && wanted.includes(text) !== ($item.attr('aria-selected') === 'true')) {
|
|
26
|
+
cy.wrap($item).find('.dx-list-select-checkbox').click();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
cy.GLO_checkLoadingIndicator();
|
|
30
|
+
}
|
|
31
|
+
enterTranslations(formName, obj.translation);
|
|
32
|
+
};
|
|
33
|
+
export const GLO_enterConsignmentSubtype = (obj) => {
|
|
34
|
+
const formName = 'ng$consignment_subtype_dtl';
|
|
35
|
+
cy.GLO_addInput([formName, 'consignment_subtype_code'], obj.code);
|
|
36
|
+
cy.GLO_checkbox([formName, 'shipment_in'], obj.flagShipmentIn);
|
|
37
|
+
cy.GLO_checkbox([formName, 'shipment_out'], obj.flagShipmentOut);
|
|
38
|
+
cy.GLO_checkbox([formName, 'require_plan_bloc'], obj.flagRequirePlanBloc);
|
|
39
|
+
enterTranslations(formName, obj.translation);
|
|
40
|
+
};
|
|
@@ -48,5 +48,13 @@ export type objLogisticContractDetail = {
|
|
|
48
48
|
tclMinTemperature?: number;
|
|
49
49
|
tclMaxTemperature?: number;
|
|
50
50
|
tclSeasonal?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
flagEdiAutoSelect?: CheckState;
|
|
53
|
+
flagDangerousGoods?: CheckState;
|
|
54
|
+
flagLimitedQuantity?: CheckState;
|
|
55
|
+
flagAdr?: CheckState;
|
|
56
|
+
flagImdg?: CheckState;
|
|
57
|
+
flagRid?: CheckState;
|
|
58
|
+
flagAdnr?: CheckState;
|
|
51
59
|
};
|
|
52
60
|
export declare const GLO_enterLogisticContractDetail: (obj: objLogisticContractDetail) => void;
|
|
@@ -26,6 +26,8 @@ export const GLO_enterLogisticContractDetail = (obj) => {
|
|
|
26
26
|
if (obj.businessUnit)
|
|
27
27
|
cy.GLO_checkLoadingIndicator();
|
|
28
28
|
cy.GLO_checkbox([formName, 'flag_tcl_required'], obj.tcl);
|
|
29
|
+
cy.GLO_addInput([formName, 'description'], obj.description);
|
|
30
|
+
cy.GLO_checkbox([formName, 'flag_edi_auto_link_contract_detail'], obj.flagEdiAutoSelect);
|
|
29
31
|
// Tab Address data
|
|
30
32
|
GLO_enterLogisticContractDetailAddressData(obj);
|
|
31
33
|
// Tab Address
|
|
@@ -110,7 +112,16 @@ const GLO_enterLogisticContractDetailPricing = (obj) => {
|
|
|
110
112
|
}
|
|
111
113
|
};
|
|
112
114
|
const GLO_enterLogisticContractDetailLaneCondition = (obj) => {
|
|
113
|
-
|
|
115
|
+
const dangerousGoods = obj.flagDangerousGoods || obj.flagLimitedQuantity || obj.flagAdr || obj.flagImdg || obj.flagRid || obj.flagAdnr;
|
|
116
|
+
if (obj.laneType ||
|
|
117
|
+
obj.truckLoad ||
|
|
118
|
+
obj.equipmentType ||
|
|
119
|
+
obj.preferreRequired ||
|
|
120
|
+
obj.transportMethod ||
|
|
121
|
+
obj.theftSensitive ||
|
|
122
|
+
obj.equipmentCategory ||
|
|
123
|
+
obj.article ||
|
|
124
|
+
dangerousGoods) {
|
|
114
125
|
cy.GLO_selectTab([formName, tabs], 'Lane conditions', open);
|
|
115
126
|
cy.GLO_addInput([formNameLaneConditions, 'lane_type'], obj.laneType);
|
|
116
127
|
cy.GLO_addInput([formNameLaneConditions, 'truck_load'], obj.truckLoad);
|
|
@@ -120,6 +131,13 @@ const GLO_enterLogisticContractDetailLaneCondition = (obj) => {
|
|
|
120
131
|
cy.GLO_checkbox([formNameLaneConditions, 'flag_theft_sensitive'], obj.theftSensitive);
|
|
121
132
|
cy.GLO_addInput([formNameLaneConditions, 'equipment_category'], obj.equipmentCategory);
|
|
122
133
|
cy.GLO_popupWindow([formNameLaneConditions, 'article'], obj.article);
|
|
134
|
+
// Dangerous goods first: the regulation checkboxes are only editable while the detail has no dangerous goods records
|
|
135
|
+
cy.GLO_checkbox([formNameLaneConditions, 'dangerous_goods'], obj.flagDangerousGoods);
|
|
136
|
+
cy.GLO_checkbox([formNameLaneConditions, 'flag_limited_qty'], obj.flagLimitedQuantity);
|
|
137
|
+
cy.GLO_checkbox([formNameLaneConditions, 'flag_adr'], obj.flagAdr);
|
|
138
|
+
cy.GLO_checkbox([formNameLaneConditions, 'flag_imdg'], obj.flagImdg);
|
|
139
|
+
cy.GLO_checkbox([formNameLaneConditions, 'flag_rid'], obj.flagRid);
|
|
140
|
+
cy.GLO_checkbox([formNameLaneConditions, 'flag_adnr'], obj.flagAdnr);
|
|
123
141
|
cy.GLO_selectTab([formName, tabs], 'Lane conditions', close);
|
|
124
142
|
}
|
|
125
143
|
};
|
|
@@ -170,10 +170,10 @@ declare global {
|
|
|
170
170
|
/**
|
|
171
171
|
* Check or uncheck a checkbox element.
|
|
172
172
|
*
|
|
173
|
-
* @param {
|
|
173
|
+
* @param {selectorType} selector - As GLO_getElement; an optional trailing number picks the row.
|
|
174
174
|
* @param {CheckState} bool - check to check, unCheck to uncheck.
|
|
175
175
|
*/
|
|
176
|
-
GLO_checkbox(selector:
|
|
176
|
+
GLO_checkbox(selector: selectorType, bool: CheckState): void;
|
|
177
177
|
/**
|
|
178
178
|
* Toggle a switch element on or off.
|
|
179
179
|
*
|
|
@@ -391,10 +391,10 @@ declare global {
|
|
|
391
391
|
/**
|
|
392
392
|
* Assert the aria-checked state of a checkbox element.
|
|
393
393
|
*
|
|
394
|
-
* @param {
|
|
394
|
+
* @param {selectorType} selector - As GLO_getElement; an optional trailing number picks the row.
|
|
395
395
|
* @param {CheckState} value - Expected state: check for checked, unCheck for unchecked.
|
|
396
396
|
*/
|
|
397
|
-
GLO_validateCheckbox(selector:
|
|
397
|
+
GLO_validateCheckbox(selector: selectorType, value: CheckState): void;
|
|
398
398
|
/**
|
|
399
399
|
* Command to check the presence of the AG Grid loader and to wait for it to disappear, ensuring the AG Grid has finished loading.
|
|
400
400
|
*
|
|
@@ -15,6 +15,17 @@ const extractSelectorParts = (selector) => {
|
|
|
15
15
|
return { baseSelector: selector.slice(0, -1), index: last };
|
|
16
16
|
return { baseSelector: selector, index: 0 };
|
|
17
17
|
};
|
|
18
|
+
// Row index of an element repeated per row, undefined when it is not in a row. AG Grid rows carry it in `row-index`.
|
|
19
|
+
// A list form component in paging mode (ListFormComponent.pagingMode) draws its rows as plain `.svy-listformcomponent-row`
|
|
20
|
+
// siblings without that attribute, so there the position among them is the index. AG Grid rows of a list form component
|
|
21
|
+
// have that class too, inside the `row-index` cell, which is why `row-index` is checked first.
|
|
22
|
+
const getRowIndex = (el) => {
|
|
23
|
+
const rowIndexEl = el.closest('[row-index]');
|
|
24
|
+
if (rowIndexEl)
|
|
25
|
+
return Number(rowIndexEl.getAttribute('row-index'));
|
|
26
|
+
const pagingRow = el.closest('.svy-listformcomponent-row');
|
|
27
|
+
return pagingRow?.parentElement ? Array.from(pagingRow.parentElement.querySelectorAll(':scope > .svy-listformcomponent-row')).indexOf(pagingRow) : undefined;
|
|
28
|
+
};
|
|
18
29
|
// When index refers to a grid row (element repeated per row), GLO_getElement handles row filtering via the full selector.
|
|
19
30
|
// When index refers to a sub-input within a single element (e.g. a field with two inputs), the caller uses eq(index).
|
|
20
31
|
// This helper distinguishes the two cases synchronously.
|
|
@@ -23,7 +34,7 @@ const isGridRowSelector = (baseSelector, index) => {
|
|
|
23
34
|
return false;
|
|
24
35
|
const selectorStr = baseSelector.length === 2 ? `[data-cy$="${baseSelector[0]}.${baseSelector[1]}"]` : `[name="${baseSelector[0]}"]`;
|
|
25
36
|
const el = Cypress.$(`div[formslist]:not([hidden]) ${selectorStr}`)[0];
|
|
26
|
-
return !!el
|
|
37
|
+
return !!el && getRowIndex(el) !== undefined;
|
|
27
38
|
};
|
|
28
39
|
// Row queries must ignore grids that are not on screen, but neither obvious filter does that job.
|
|
29
40
|
// Servoy marks the *containers* hidden - `div[formslist][hidden]` for background programs,
|
|
@@ -40,8 +51,8 @@ const pickByRowIndex = (chain, index, log = false, timeout = defaultTimeout) =>
|
|
|
40
51
|
if (log)
|
|
41
52
|
Cypress.log({ name: 'idx', message: String(index) });
|
|
42
53
|
return chain.filter((i, el) => {
|
|
43
|
-
const
|
|
44
|
-
return
|
|
54
|
+
const rowIndex = getRowIndex(el);
|
|
55
|
+
return rowIndex !== undefined ? rowIndex === index : i === index;
|
|
45
56
|
}, { timeout });
|
|
46
57
|
};
|
|
47
58
|
Cypress.Commands.add('GLO_getElement', (selectorArg, options = {}) => {
|