@onehat/ui 0.4.24 → 0.4.26
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/package.json +1 -1
- package/src/Components/Editor/Editor.js +5 -1
- package/src/Components/Form/Field/Combo/Combo.js +10 -5
- package/src/Components/Form/Field/Tag/Tag.js +2 -2
- package/src/Components/Form/Field/Tag/ValueBox.js +19 -14
- package/src/Components/Grid/Grid.js +6 -3
- package/src/Components/Messages/ErrorMessage.js +70 -25
- package/src/Components/Toolbar/PaginationToolbar.js +3 -2
- package/src/Functions/Cypress/button_functions.js +2 -2
- package/src/Functions/Cypress/crud_functions.js +7 -18
- package/src/Functions/Cypress/dom_functions.js +6 -0
- package/src/Functions/Cypress/form_functions.js +0 -9
- package/src/Functions/Cypress/utilities.js +8 -1
- package/src/Functions/testProps.js +4 -1
- package/src/Styles/Global.css +2 -2
- package/src/Components/Window/Editor.js +0 -14
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EDITOR_MODE__VIEW,
|
|
3
|
+
EDITOR_TYPE__SIDE,
|
|
3
4
|
} from '../../Constants/Editor.js';
|
|
4
5
|
import withComponent from '../Hoc/withComponent.js';
|
|
5
6
|
import withPdfButtons from '../Hoc/withPdfButtons.js';
|
|
@@ -34,7 +35,10 @@ function Editor(props) {
|
|
|
34
35
|
return null; // hide the editor when no selection
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
const propsToPass = _.omit(props, ['self', 'reference', 'parent']);
|
|
38
|
+
const propsToPass = _.omit(props, ['self', 'reference', 'parent', 'style']);
|
|
39
|
+
if (propsToPass.editorType === EDITOR_TYPE__SIDE) {
|
|
40
|
+
propsToPass.style = props.style; // side editor needs the style prop, but a windowed editor can get messed up if it's present (and withModal is used)!
|
|
41
|
+
}
|
|
38
42
|
|
|
39
43
|
let canEdit = true;
|
|
40
44
|
if (canRecordBeEdited && !canRecordBeEdited(selection)) {
|
|
@@ -180,7 +180,7 @@ export function ComboComponent(props) {
|
|
|
180
180
|
displayValue = _.each(value, (id) => {
|
|
181
181
|
const entity = Repository.getById(id);
|
|
182
182
|
if (entity) {
|
|
183
|
-
displayValue.push(entity.displayValue)
|
|
183
|
+
displayValue.push(entity.displayValue);
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
186
|
} else {
|
|
@@ -202,6 +202,9 @@ export function ComboComponent(props) {
|
|
|
202
202
|
await Repository.waitUntilDoneLoading();
|
|
203
203
|
}
|
|
204
204
|
entity = Repository.getById(value);
|
|
205
|
+
if (!entity) {
|
|
206
|
+
entity = await Repository.getSingleEntityFromServer(value);
|
|
207
|
+
}
|
|
205
208
|
}
|
|
206
209
|
displayValue = entity?.displayValue || '';
|
|
207
210
|
} else {
|
|
@@ -243,10 +246,12 @@ export function ComboComponent(props) {
|
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
let id = null;
|
|
246
|
-
if (gridSelection.length
|
|
247
|
-
id = gridSelection[0].id;
|
|
249
|
+
if (gridSelection.length) {
|
|
250
|
+
id = Repository ? gridSelection[0].id : gridSelection[0][idIx];
|
|
251
|
+
}
|
|
252
|
+
if (id !== value) {
|
|
253
|
+
setValue(id);
|
|
248
254
|
}
|
|
249
|
-
setValue(id);
|
|
250
255
|
hideMenu();
|
|
251
256
|
break;
|
|
252
257
|
case 'ArrowDown':
|
|
@@ -449,7 +454,7 @@ export function ComboComponent(props) {
|
|
|
449
454
|
}
|
|
450
455
|
} else {
|
|
451
456
|
// Search through data
|
|
452
|
-
const regex = new RegExp('^' + value);
|
|
457
|
+
const regex = new RegExp('^' + value, 'i'); // case-insensitive
|
|
453
458
|
found = _.filter(data, (item) => {
|
|
454
459
|
if (_.isString(item[displayIx]) && _.isString(value)) {
|
|
455
460
|
return item[displayIx].match(regex);
|
|
@@ -77,7 +77,6 @@ function TagComponent(props) {
|
|
|
77
77
|
showModal({
|
|
78
78
|
body: <Editor
|
|
79
79
|
editorType={EDITOR_TYPE__WINDOWED}
|
|
80
|
-
{...propsToPass}
|
|
81
80
|
parent={self}
|
|
82
81
|
reference="viewer"
|
|
83
82
|
isEditorViewOnly={true}
|
|
@@ -234,6 +233,7 @@ function TagComponent(props) {
|
|
|
234
233
|
onView={() => onView(val)}
|
|
235
234
|
onDelete={!isViewOnly ? () => onDelete(val) : null}
|
|
236
235
|
showEye={showEye}
|
|
236
|
+
minimizeForRow={minimizeForRow}
|
|
237
237
|
/>;
|
|
238
238
|
});
|
|
239
239
|
|
|
@@ -297,7 +297,7 @@ function TagComponent(props) {
|
|
|
297
297
|
valueBoxesClassName += ' min-h-[25px] h-full overflow-auto flex-1';
|
|
298
298
|
} else {
|
|
299
299
|
// shrink both down
|
|
300
|
-
valueBoxesClassName += ' h-auto min-h-[25px] max-h-[
|
|
300
|
+
valueBoxesClassName += ' Scott h-auto min-h-[25px] max-h-[35px] overflow-auto flex-1';
|
|
301
301
|
comboClassName += ' h-auto min-h-0 max-h-[25px] flex-1';
|
|
302
302
|
}
|
|
303
303
|
}
|
|
@@ -15,6 +15,7 @@ export default function ValueBox(props) {
|
|
|
15
15
|
onView,
|
|
16
16
|
onDelete,
|
|
17
17
|
showEye,
|
|
18
|
+
minimizeForRow = false,
|
|
18
19
|
} = props,
|
|
19
20
|
styles = UiGlobals.styles;
|
|
20
21
|
return <HStackNative
|
|
@@ -31,20 +32,22 @@ export default function ValueBox(props) {
|
|
|
31
32
|
${!onDelete && 'pr-4'}
|
|
32
33
|
`}
|
|
33
34
|
>
|
|
34
|
-
{showEye &&
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
{showEye &&
|
|
36
|
+
<IconButton
|
|
37
|
+
{...testProps('eyeBtn')}
|
|
38
|
+
icon={Eye}
|
|
39
|
+
_icon={{
|
|
40
|
+
size: styles.FORM_TAG_VALUEBOX_ICON_SIZE,
|
|
41
|
+
className: 'text-grey-600',
|
|
42
|
+
}}
|
|
43
|
+
onPress={onView}
|
|
44
|
+
className={`
|
|
45
|
+
ValueBox-eyeBtn
|
|
46
|
+
h-full
|
|
47
|
+
${minimizeForRow ? 'py-0' : ''}
|
|
48
|
+
${styles.FORM_TAG_BTN_CLASSNAME}
|
|
49
|
+
`}
|
|
50
|
+
/>}
|
|
48
51
|
<Text
|
|
49
52
|
className={`
|
|
50
53
|
ValueBox-Text
|
|
@@ -52,6 +55,7 @@ export default function ValueBox(props) {
|
|
|
52
55
|
${styles.FORM_TAG_VALUEBOX_CLASSNAME}
|
|
53
56
|
${showEye ? 'ml-0' : 'ml-1'}
|
|
54
57
|
${onDelete ? 'mr-0' : 'mr-1'}
|
|
58
|
+
${minimizeForRow ? 'py-0' : ''}
|
|
55
59
|
`}
|
|
56
60
|
>{text}</Text>
|
|
57
61
|
{onDelete &&
|
|
@@ -66,6 +70,7 @@ export default function ValueBox(props) {
|
|
|
66
70
|
className={`
|
|
67
71
|
ValueBox-xBtn
|
|
68
72
|
h-full
|
|
73
|
+
${minimizeForRow ? 'py-0' : ''}
|
|
69
74
|
${styles.FORM_TAG_BTN_CLASSNAME}
|
|
70
75
|
`}
|
|
71
76
|
/>}
|
|
@@ -153,6 +153,7 @@ function GridComponent(props) {
|
|
|
153
153
|
alternateRowBackgrounds = true,
|
|
154
154
|
alternatingInterval = 2,
|
|
155
155
|
defaultRowHeight = 48,
|
|
156
|
+
getRowTestId,
|
|
156
157
|
|
|
157
158
|
// The selectorSelected mechanism allows us to filter results of the primary model, (e.g. WorkOrders)
|
|
158
159
|
// by the selection on the secondary model (e.g. Equipment). It's used on Grids, Trees, Forms, etc.
|
|
@@ -390,7 +391,7 @@ function GridComponent(props) {
|
|
|
390
391
|
|
|
391
392
|
let rowComponent =
|
|
392
393
|
<Pressable
|
|
393
|
-
{...testProps((Repository ? Repository.schema.name : 'GridRow') + '-' + item?.id)}
|
|
394
|
+
{...testProps(getRowTestId ? getRowTestId(row) : ((Repository ? Repository.schema.name : 'GridRow') + '-' + item?.id))}
|
|
394
395
|
onPress={(e) => {
|
|
395
396
|
if (e.preventDefault && e.cancelable) {
|
|
396
397
|
e.preventDefault();
|
|
@@ -597,6 +598,7 @@ function GridComponent(props) {
|
|
|
597
598
|
`}
|
|
598
599
|
>
|
|
599
600
|
<ExpandButton
|
|
601
|
+
{...testProps((Repository ? Repository.schema.name : 'GridRow') + '-expandBtn-' + item?.id)}
|
|
600
602
|
isExpanded={isExpanded}
|
|
601
603
|
onToggle={() => setIsExpanded(index, !isExpanded)}
|
|
602
604
|
_icon={{
|
|
@@ -1272,7 +1274,8 @@ function GridComponent(props) {
|
|
|
1272
1274
|
</VStackNative>
|
|
1273
1275
|
|
|
1274
1276
|
if (isDropTarget) {
|
|
1275
|
-
grid = <
|
|
1277
|
+
grid = <VStackNative
|
|
1278
|
+
{...testProps(self, '-dropTarget')}
|
|
1276
1279
|
ref={dropTargetRef}
|
|
1277
1280
|
className={`
|
|
1278
1281
|
Grid-dropTarget
|
|
@@ -1281,7 +1284,7 @@ function GridComponent(props) {
|
|
|
1281
1284
|
border-[#0ff]
|
|
1282
1285
|
${canDrop && isOver ? "border-[4px]" : "border-[0px]"}
|
|
1283
1286
|
`}
|
|
1284
|
-
>{grid}</
|
|
1287
|
+
>{grid}</VStackNative>
|
|
1285
1288
|
}
|
|
1286
1289
|
return grid;
|
|
1287
1290
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Box,
|
|
3
|
-
|
|
3
|
+
HStack,
|
|
4
4
|
Icon,
|
|
5
5
|
Modal, ModalBackdrop, ModalHeader, ModalContent, ModalCloseButton, ModalBody, ModalFooter,
|
|
6
6
|
Text,
|
|
7
7
|
} from '@project-components/Gluestack';
|
|
8
|
-
import
|
|
8
|
+
import useAdjustedWindowSize from '../../Hooks/useAdjustedWindowSize.js';
|
|
9
|
+
import Button from '../Buttons/Button.js';
|
|
10
|
+
import Panel from '../Panel/Panel.js';
|
|
11
|
+
import Footer from '../Layout/Footer.js';
|
|
9
12
|
import testProps from '../../Functions/testProps.js';
|
|
10
13
|
import TriangleExclamation from '../Icons/TriangleExclamation.js';
|
|
11
14
|
|
|
@@ -14,33 +17,75 @@ export default function ErrorMessage(props) {
|
|
|
14
17
|
text = 'Error',
|
|
15
18
|
color = 'red-500',
|
|
16
19
|
onOk,
|
|
17
|
-
} = props
|
|
20
|
+
} = props,
|
|
21
|
+
[width, height] = useAdjustedWindowSize(500, 250);
|
|
18
22
|
|
|
19
23
|
return <Modal isOpen={true} {...props} {...testProps('ErrorMessage')}>
|
|
20
24
|
<ModalBackdrop />
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
<Panel
|
|
27
|
+
title="Alert"
|
|
28
|
+
isCollapsible={false}
|
|
29
|
+
className="bg-white overflow-auto"
|
|
30
|
+
h={height}
|
|
31
|
+
w={width}
|
|
32
|
+
isWindow={true}
|
|
33
|
+
disableAutoFlex={true}
|
|
34
|
+
onClose={onOk}
|
|
35
|
+
footer={<Footer
|
|
36
|
+
className={`
|
|
37
|
+
justify-end
|
|
38
|
+
py-2
|
|
39
|
+
px-4
|
|
40
|
+
bg-grey-100
|
|
41
|
+
`}
|
|
42
|
+
>
|
|
43
|
+
<Button
|
|
44
|
+
{...testProps('okBtn')}
|
|
45
|
+
key="okBtn"
|
|
46
|
+
onPress={onOk}
|
|
47
|
+
text="OK"
|
|
48
|
+
className="text-white"
|
|
49
|
+
/>
|
|
50
|
+
</Footer>}
|
|
51
|
+
>
|
|
52
|
+
<HStack className="ErrorMessage-HStack flex-1 w-full p-4">
|
|
53
|
+
<Box className={`
|
|
54
|
+
ErrorMessage-Box1
|
|
55
|
+
h-full
|
|
56
|
+
w-[100px]
|
|
57
|
+
flex
|
|
58
|
+
items-center
|
|
59
|
+
justify-center
|
|
60
|
+
pr-3
|
|
61
|
+
`}>
|
|
62
|
+
<Icon as={TriangleExclamation} className={`
|
|
63
|
+
ErrorMessage-Icon
|
|
64
|
+
h-[40px]
|
|
65
|
+
w-[40px]
|
|
66
|
+
text-${color}
|
|
67
|
+
`} />
|
|
68
|
+
</Box>
|
|
69
|
+
<Box className={`
|
|
70
|
+
ErrorMessage-Box2
|
|
71
|
+
h-full
|
|
72
|
+
flex
|
|
73
|
+
flex-1
|
|
74
|
+
items-start
|
|
27
75
|
justify-center
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
76
|
+
overflow-hidden
|
|
77
|
+
`}>
|
|
78
|
+
<Text className={`
|
|
79
|
+
ErrorMessage-Text
|
|
80
|
+
text-${color}
|
|
81
|
+
text-[18px]
|
|
82
|
+
break-words
|
|
83
|
+
whitespace-normal
|
|
84
|
+
w-full
|
|
85
|
+
overflow-auto
|
|
86
|
+
`}>{text}</Text>
|
|
36
87
|
</Box>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<ModalFooter className="py-2 pr-4">
|
|
40
|
-
<Button onPress={onOk} className="text-primary-800">
|
|
41
|
-
<ButtonText>OK</ButtonText>
|
|
42
|
-
</Button>
|
|
43
|
-
</ModalFooter>
|
|
44
|
-
</ModalContent>
|
|
88
|
+
</HStack>
|
|
89
|
+
</Panel>
|
|
45
90
|
</Modal>;
|
|
46
91
|
}
|
|
@@ -47,8 +47,9 @@ export default function PaginationToolbar(props) {
|
|
|
47
47
|
minimize={minimize}
|
|
48
48
|
disablePageSize={disablePageSize}
|
|
49
49
|
/>
|
|
50
|
-
{toolbarItems.length
|
|
50
|
+
{toolbarItems.length ?
|
|
51
51
|
<HStack className={`
|
|
52
|
+
PaginationToolbar-HStack
|
|
52
53
|
flex-1
|
|
53
54
|
space-x-1
|
|
54
55
|
border-l
|
|
@@ -56,6 +57,6 @@ export default function PaginationToolbar(props) {
|
|
|
56
57
|
ml-3
|
|
57
58
|
pl-3
|
|
58
59
|
`}
|
|
59
|
-
>{toolbarItems}</HStack>}
|
|
60
|
+
>{toolbarItems}</HStack> : null}
|
|
60
61
|
</Toolbar>;
|
|
61
62
|
};
|
|
@@ -85,11 +85,11 @@ export function clickToViewButtonIfExists(parentSelectors) {
|
|
|
85
85
|
}
|
|
86
86
|
export function toFullMode(parentSelectors) {
|
|
87
87
|
cy.log('toFullMode');
|
|
88
|
-
return
|
|
88
|
+
return clickButtonIfEnabled(parentSelectors, 'fullModeBtn');
|
|
89
89
|
}
|
|
90
90
|
export function toSideMode(parentSelectors) {
|
|
91
91
|
cy.log('toSideMode');
|
|
92
|
-
return
|
|
92
|
+
return clickButtonIfEnabled(parentSelectors, 'sideModeBtn');
|
|
93
93
|
}
|
|
94
94
|
export function clickButton(parentSelectors, name) { // requires the button to be enabled
|
|
95
95
|
if (_.isString(parentSelectors)) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fixInflector,
|
|
3
3
|
getLastPartOfPath,
|
|
4
|
+
bootstrapRouteWaiters,
|
|
4
5
|
} from './utilities.js';
|
|
5
6
|
import {
|
|
6
7
|
login,
|
|
@@ -208,9 +209,6 @@ export function addGridRecord(gridSelector, fieldValues, schema, ancillaryData,
|
|
|
208
209
|
formSelector = editorSelector + '/form',
|
|
209
210
|
isRemotePhantomMode = schema.repository.isRemotePhantomMode;
|
|
210
211
|
|
|
211
|
-
if (isRemotePhantomMode) {
|
|
212
|
-
cy.intercept('POST', '**/add**').as('addWaiter');
|
|
213
|
-
}
|
|
214
212
|
clickAddButton(gridSelector);
|
|
215
213
|
if (isRemotePhantomMode) {
|
|
216
214
|
cy.wait('@addWaiter');
|
|
@@ -225,7 +223,6 @@ export function addGridRecord(gridSelector, fieldValues, schema, ancillaryData,
|
|
|
225
223
|
if (isRemotePhantomMode) {
|
|
226
224
|
method = 'edit';
|
|
227
225
|
}
|
|
228
|
-
cy.intercept('POST', '**/' + method + '**').as(method + 'Waiter');
|
|
229
226
|
clickSaveButton(formSelector); // it's labeled 'Add' in the form, but is really the save button
|
|
230
227
|
cy.wait('@' + method + 'Waiter');
|
|
231
228
|
|
|
@@ -278,7 +275,7 @@ export function addInlineGridRecord(gridSelector, fieldValues, schema, ancillary
|
|
|
278
275
|
|
|
279
276
|
cy.log('addInlineGridRecord ' + gridSelector);
|
|
280
277
|
|
|
281
|
-
addGridRecord(gridSelector, fieldValues, schema,
|
|
278
|
+
addGridRecord(gridSelector, fieldValues, schema, [], level); // NOTE: ancillaryData is not passed to addGridRecord because can't edit ancillary data in an inline editor
|
|
282
279
|
|
|
283
280
|
cy.log('addWindowedGridRecord: close window ' + gridSelector);
|
|
284
281
|
const formSelector = gridSelector + '/editor/form';
|
|
@@ -310,10 +307,7 @@ export function editGridRecord(gridSelector, fieldValues, schema, id, level = 0,
|
|
|
310
307
|
fillForm(formSelector, fieldValues, schema, level +1);
|
|
311
308
|
cy.wait(500); // allow validator to enable save button
|
|
312
309
|
// TODO: Change this to wait until save button is enabled
|
|
313
|
-
|
|
314
|
-
if (!existingEditWaiter) {
|
|
315
|
-
cy.intercept('POST', '**/edit**').as('editWaiter');
|
|
316
|
-
}
|
|
310
|
+
|
|
317
311
|
clickSaveButton(formSelector);
|
|
318
312
|
cy.wait('@editWaiter');
|
|
319
313
|
|
|
@@ -353,7 +347,6 @@ export function deleteGridRecord(gridSelector, id) {
|
|
|
353
347
|
cy.wait(500); // allow confirmation box to appear
|
|
354
348
|
|
|
355
349
|
// Click OK on confirmation box
|
|
356
|
-
cy.intercept('POST', '**/delete**').as('deleteWaiter');
|
|
357
350
|
clickYesButton('ConfirmModal');
|
|
358
351
|
cy.wait('@deleteWaiter');
|
|
359
352
|
|
|
@@ -472,7 +465,6 @@ export function addTreeRecord(treeSelector, fieldValues, schema, ancillaryData,
|
|
|
472
465
|
if (schema.repository.isRemotePhantomMode) {
|
|
473
466
|
method = 'edit';
|
|
474
467
|
}
|
|
475
|
-
cy.intercept('POST', '**/' + method + '**').as(method + 'Waiter');
|
|
476
468
|
clickSaveButton(formSelector); // it's labeled 'Add' in the form, but is really the save button
|
|
477
469
|
cy.wait('@' + method + 'Waiter');
|
|
478
470
|
|
|
@@ -545,10 +537,6 @@ export function editTreeRecord(treeSelector, fieldValues, schema, id, level = 0,
|
|
|
545
537
|
cy.wait(500); // allow validator to enable save button
|
|
546
538
|
// TODO: Change this to wait until save button is enabled
|
|
547
539
|
|
|
548
|
-
const existingEditWaiter = Cypress.state('aliases')['editWaiter'];
|
|
549
|
-
if (!existingEditWaiter) {
|
|
550
|
-
cy.intercept('POST', '**/edit**').as('editWaiter');
|
|
551
|
-
}
|
|
552
540
|
clickSaveButton(formSelector);
|
|
553
541
|
cy.wait('@editWaiter');
|
|
554
542
|
|
|
@@ -577,7 +565,6 @@ export function deleteTreeRecord(treeSelector, id) {
|
|
|
577
565
|
cy.wait(500); // allow confirmation box to appear
|
|
578
566
|
|
|
579
567
|
// Click OK on confirmation box
|
|
580
|
-
cy.intercept('POST', '**/delete**').as('deleteWaiter');
|
|
581
568
|
clickYesButton('ConfirmModal');
|
|
582
569
|
cy.wait('@deleteWaiter');
|
|
583
570
|
|
|
@@ -596,6 +583,7 @@ export function runClosureTreeControlledManagerScreenCrudTests(model, schema, ne
|
|
|
596
583
|
describe(Models + 'Manager', () => {
|
|
597
584
|
|
|
598
585
|
beforeEach(function () {
|
|
586
|
+
bootstrapRouteWaiters();
|
|
599
587
|
login();
|
|
600
588
|
cy.restoreLocalStorage();
|
|
601
589
|
cy.url().then((currentUrl) => {
|
|
@@ -692,6 +680,7 @@ export function runClosureTreeManagerScreenCrudTests(args) {
|
|
|
692
680
|
describe(Models + 'Manager', () => {
|
|
693
681
|
|
|
694
682
|
beforeEach(function () {
|
|
683
|
+
bootstrapRouteWaiters();
|
|
695
684
|
login();
|
|
696
685
|
cy.restoreLocalStorage();
|
|
697
686
|
cy.url().then((currentUrl) => {
|
|
@@ -756,6 +745,7 @@ export function runManagerScreenCrudTests(args) {
|
|
|
756
745
|
describe(Models + 'Manager', () => {
|
|
757
746
|
|
|
758
747
|
beforeEach(function () {
|
|
748
|
+
bootstrapRouteWaiters();
|
|
759
749
|
login();
|
|
760
750
|
cy.restoreLocalStorage();
|
|
761
751
|
cy.url().then((currentUrl) => {
|
|
@@ -814,6 +804,7 @@ export function runReportsManagerTests(reportData) {
|
|
|
814
804
|
describe('ReportsManager', () => {
|
|
815
805
|
|
|
816
806
|
beforeEach(function () {
|
|
807
|
+
bootstrapRouteWaiters();
|
|
817
808
|
login();
|
|
818
809
|
cy.url().then((currentUrl) => {
|
|
819
810
|
if (!currentUrl.endsWith(url)) {
|
|
@@ -836,7 +827,6 @@ export function runReportsManagerTests(reportData) {
|
|
|
836
827
|
|
|
837
828
|
|
|
838
829
|
// Press Excel button
|
|
839
|
-
cy.intercept('GET', '**/getReport**').as('getWaiter');
|
|
840
830
|
clickButton(selector, 'excelBtn');
|
|
841
831
|
cy.wait('@getWaiter', { timeout: 10000 }).then((interception) => {
|
|
842
832
|
expect(interception.response.headers['content-type']).to.include('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
@@ -844,7 +834,6 @@ export function runReportsManagerTests(reportData) {
|
|
|
844
834
|
|
|
845
835
|
|
|
846
836
|
// Press PDF button
|
|
847
|
-
cy.intercept('POST', '**/getReport**').as('getReportWaiter');
|
|
848
837
|
clickButton(selector, 'pdfBtn');
|
|
849
838
|
cy.wait('@getReportWaiter', { timeout: 10000 }).then((interception) => {
|
|
850
839
|
expect(interception.response.headers['content-type']).to.include('pdf');
|
|
@@ -37,6 +37,12 @@ export function getTestIdSelectors(selectors, isGetFirst = false) {
|
|
|
37
37
|
if (selector.match(/=/)) { // selector is something like [role="switch"], so don't use data-testid
|
|
38
38
|
return selector;
|
|
39
39
|
}
|
|
40
|
+
if (selector.match(/^\./)) { // selector is something like .my-class, so don't use data-testid
|
|
41
|
+
return selector;
|
|
42
|
+
}
|
|
43
|
+
if (selector.match(/^#/)) { // selector is something like #my-id, so don't use data-testid
|
|
44
|
+
return selector;
|
|
45
|
+
}
|
|
40
46
|
return '[data-testid="' + selector + '"]' + (isGetFirst ? ':first' : '');
|
|
41
47
|
});
|
|
42
48
|
return selectorParts.join(' ');
|
|
@@ -139,11 +139,6 @@ export function setComboValue(selectors, value) {
|
|
|
139
139
|
// cy.get(field).clear({ force: true });
|
|
140
140
|
clickXButtonIfEnabled(selectors); // clear current value
|
|
141
141
|
if (value) {
|
|
142
|
-
const existingGetWaiter = Cypress.state('aliases')['getWaiter'];
|
|
143
|
-
if (!existingGetWaiter) {
|
|
144
|
-
cy.intercept('GET', '**/get**').as('getWaiter'); // set up waiter
|
|
145
|
-
}
|
|
146
|
-
|
|
147
142
|
cy.get(field)
|
|
148
143
|
.type(value, { delay: 40, force: true }) // slow it down a bit, so React has time to re-render
|
|
149
144
|
.wait('@getWaiter'); // allow dropdown to load
|
|
@@ -186,10 +181,6 @@ export function setTagValue(selectors, value) {
|
|
|
186
181
|
if (!_.isEmpty(values)) {
|
|
187
182
|
_.each(values, (value) => {
|
|
188
183
|
const id = value.id;
|
|
189
|
-
const existingGetWaiter = Cypress.state('aliases')['getWaiter'];
|
|
190
|
-
if (!existingGetWaiter) {
|
|
191
|
-
cy.intercept('GET', '**/get**').as('getWaiter'); // set up waiter
|
|
192
|
-
}
|
|
193
184
|
cy.get(field)
|
|
194
185
|
.type('id:' + id, { delay: 40, force: true }) // slow it down a bit, so React has time to re-render
|
|
195
186
|
.wait('@getWaiter'); // allow dropdown to load
|
|
@@ -6,7 +6,14 @@ import moment from 'moment';
|
|
|
6
6
|
// / /_/ / /_/ / / / /_/ / __(__ )
|
|
7
7
|
// \____/\__/_/_/_/\__/_/\___/____/
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
export function bootstrapRouteWaiters() {
|
|
10
|
+
cy.log('bootstrapRouteWaiters');
|
|
11
|
+
cy.intercept('GET', '**/get**').as('getWaiter');
|
|
12
|
+
cy.intercept('POST', '**/add**').as('addWaiter');
|
|
13
|
+
cy.intercept('POST', '**/edit**').as('editWaiter');
|
|
14
|
+
cy.intercept('POST', '**/delete**').as('deleteWaiter');
|
|
15
|
+
cy.intercept('POST', '**/getReport**').as('getReportWaiter');
|
|
16
|
+
}
|
|
10
17
|
export function fixInflector(str) {
|
|
11
18
|
// inflector-js doesn't handle pluralization of 'equipment' correctly
|
|
12
19
|
str = str.replace(/quipments/, 'quipment');
|
|
@@ -4,7 +4,7 @@ import UiGlobals from '../UiGlobals.js';
|
|
|
4
4
|
// This adds a data-testid attribute to the DOM node,
|
|
5
5
|
// which can be quried in Cypress by: document.querySelector(`[data-testid='MyTestId']`);
|
|
6
6
|
|
|
7
|
-
export default function testProps(id) {
|
|
7
|
+
export default function testProps(id, suffix) {
|
|
8
8
|
if (!UiGlobals.debugMode) {
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
@@ -19,6 +19,9 @@ export default function testProps(id) {
|
|
|
19
19
|
if (id.match(/\s/g)) {
|
|
20
20
|
id = id.replace(/\s/g, '_'); // convert any spaces to underscores
|
|
21
21
|
}
|
|
22
|
+
if (suffix) {
|
|
23
|
+
id += suffix; // this is used in conjunction with 'self' object
|
|
24
|
+
}
|
|
22
25
|
if (!window && Platform.OS === 'android') {
|
|
23
26
|
return {
|
|
24
27
|
accessibilityLabel: id,
|
package/src/Styles/Global.css
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import Container from '../Container/Container.js';
|
|
2
|
-
import emptyFn from '../../Functions/emptyFn.js';
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
|
|
5
|
-
export default function EditorWindow(props) {
|
|
6
|
-
const {
|
|
7
|
-
title,
|
|
8
|
-
isOpen = false,
|
|
9
|
-
onClose = emptyFn,
|
|
10
|
-
...propsToPass
|
|
11
|
-
} = props;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|