Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/master/playwright/…
Browse files Browse the repository at this point in the history
…test-1.47.0
  • Loading branch information
RFSH authored Sep 10, 2024
2 parents 703c822 + b4c1b0c commit db126b0
Show file tree
Hide file tree
Showing 58 changed files with 2,245 additions and 2,712 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ jobs:
echo "Waiting for Sauce Connect..."
sleep 5;
done;
- name: Run all features confirmation test spec (protractor)
id: test-protractor-all-features-confirmation
continue-on-error: true
run: |
cd chaise
make testallfeaturesconfirmation-protractor
- name: Run default config test spec (protractor)
id: test-protractor-default-config
continue-on-error: true
Expand All @@ -191,9 +185,6 @@ jobs:
- name: Check on delete prohibited test spec
if: always() && steps.test-delete-prohibited.outcome != 'success'
run: exit 1
- name: Check on all features confirmation test spec (protractor)
if: always() && steps.test-protractor-all-features-confirmation.outcome != 'success'
run: exit 1
- name: Check on default config test spec (protractor)
if: always() && steps.test-protractor-default-config.outcome != 'success'
run: exit 1
Expand Down
32 changes: 11 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ MODULES=node_modules
### test scripts
## Sequential test scripts
# Recordedit tests
E2EDIrecordAdd=test/e2e/specs/all-features-confirmation/recordedit/add.conf.js
E2EDIrecordEditMultiColTypes=test/e2e/specs/default-config/recordedit/multi-col-types.conf.js
E2EDIrecordAdd=test/e2e/specs/all-features-confirmation/recordedit/add.config.ts
E2EDrecordEditNullValues=test/e2e/specs/default-config/recordedit/null-values.config.ts
E2EDIrecordImmutable=test/e2e/specs/default-config/recordedit/immutable-inputs.conf.js
E2EDIrecordEdit=test/e2e/specs/all-features-confirmation/recordedit/edit-delete.conf.js
E2EDIrecordEdit=test/e2e/specs/all-features-confirmation/recordedit/edit-delete.config.ts
# not part of the make recordedit command anymore
E2EDIrecordMultiFormInput=test/e2e/specs/default-config/multi-form-input/multi-form-input.config.ts
E2EDIrecordMultiEdit=test/e2e/specs/default-config/recordedit/multi-edit.conf.js
E2EDrecordEditCompositeKey=test/e2e/specs/default-config/recordedit/composite-key.config.ts
E2EDrecordEditDomainFilter=test/e2e/specs/default-config/recordedit/domain-filter.config.ts
E2EDrecordEditSubmissionDisabled=test/e2e/specs/default-config/recordedit/submission-disabled.conf.js
Expand All @@ -64,8 +63,8 @@ E2EDrecordRelatedTable=test/e2e/specs/all-features/record/related-table.config.t
E2EDrecordLinks=test/e2e/specs/default-config/record/links.config.ts
# Recordset tests
E2EDrecordset=test/e2e/specs/all-features-confirmation/recordset/presentation.config.ts
E2EDrecordsetEdit=test/e2e/specs/default-config/recordset/edit.conf.js
E2ErecordsetAdd=test/e2e/specs/default-config/recordset/add.conf.js
E2EDrecordsetEdit=test/e2e/specs/default-config/recordset/edit.config.ts
E2ErecordsetAdd=test/e2e/specs/default-config/recordset/add.config.ts
E2EDrecordsetIndFacet=test/e2e/specs/delete-prohibited/recordset/facet.config.ts
E2EDrecordsetHistFacet=test/e2e/specs/delete-prohibited/recordset/histogram-facet.config.ts
E2ErecordsetSavedQuery=test/e2e/specs/all-features/recordset/saved-query.config.ts
Expand All @@ -80,7 +79,6 @@ E2Efooter=test/e2e/specs/all-features-confirmation/footer/playwright.config.ts
# errors test
E2Eerrors=test/e2e/specs/all-features-confirmation/errors/errors.config.ts
## Parallel test scripts (protractor)
AllFeaturesConfirmationParallel_PROTRACTOR=test/e2e/specs/all-features-confirmation/protractor.conf.js
DefaultConfigParallel_PROTRACTOR=test/e2e/specs/default-config/protractor.conf.js
## Parallel test scripts
AllFeaturesParallel=test/e2e/specs/all-features/playwright.config.ts
Expand All @@ -91,20 +89,18 @@ DefaultConfigParallel=test/e2e/specs/default-config/playwright.config.ts
Manualrecordset=test/manual/specs/recordset.conf.js

# protractor tests
RECORDSET_TESTS_PROTRACTOR=$(E2ErecordsetAdd) $(E2EDrecordsetEdit)
RECORDADD_TESTS_PROTRACTOR=$(E2EDIrecordAdd) $(E2EDIrecordMultiFormInput) $(E2EDIrecordImmutable)
RECORDEDIT_TESTS_PROTRACTOR=$(E2EDIrecordEdit) $(E2EDIrecordMultiEdit) $(E2EDrecordEditSubmissionDisabled) $(E2EDIrecordEditMultiColTypes)
RECORDADD_TESTS_PROTRACTOR=$(E2EDIrecordMultiFormInput) $(E2EDIrecordImmutable)
RECORDEDIT_TESTS_PROTRACTOR=$(E2EDrecordEditSubmissionDisabled)
DEFAULT_CONFIG_PARALLEL_TESTS_PROTRACTOR=$(DefaultConfigParallel_PROTRACTOR)
ALL_FEATURES_CONFIRMATION_PARALLEL_TESTS_PROTRACTOR=$(AllFeaturesConfirmationParallel_PROTRACTOR)
PARALLEL_TESTS_PROTRACTOR=$(AllFeaturesConfirmationParallel_PROTRACTOR) $(DefaultConfigParallel_PROTRACTOR)
PARALLEL_TESTS_PROTRACTOR=$(DefaultConfigParallel_PROTRACTOR)
ALL_TESTS_PROTRACTOR=$(RECORDSET_TESTS_PROTRACTOR) $(RECORDADD_TESTS_PROTRACTOR) $(RECORDEDIT_TESTS_PROTRACTOR)

# playwright tests
NAVBAR_TESTS=$(E2Enavbar) $(E2EnavbarHeadTitle) $(E2EnavbarCatalogConfig)
RECORD_TESTS=$(E2EDrecord) $(E2ErecordNoDeleteBtn) $(E2EDrecordRelatedTable) $(E2EDrecordCopy) $(E2EDrecordLinks)
RECORDSET_TESTS=$(E2EDrecordset) $(E2ErecordsetSavedQuery) $(E2EDrecordsetIndFacet) $(E2EDrecordsetHistFacet)
RECORDADD_TESTS=$(E2EDIrecordMultiFormInput) $(E2ErecordEditForeignKeyDropdown) $(E2EDrecordEditCompositeKey)
RECORDEDIT_TESTS=$(E2ErecordEditInputIframe) $(E2EDrecordEditDomainFilter)
RECORDSET_TESTS=$(E2EDrecordset) $(E2ErecordsetAdd) $(E2EDrecordsetEdit) $(E2ErecordsetSavedQuery) $(E2EDrecordsetIndFacet) $(E2EDrecordsetHistFacet)
RECORDADD_TESTS=$(E2EDIrecordAdd) $(E2EDIrecordMultiFormInput) $(E2ErecordEditForeignKeyDropdown) $(E2EDrecordEditCompositeKey)
RECORDEDIT_TESTS=$(E2EDIrecordEdit) $(E2EDrecordEditNullValues) $(E2ErecordEditInputIframe) $(E2EDrecordEditDomainFilter)
PERMISSIONS_TESTS=$(E2EmultiPermissionsVisibility)
FOOTER_TESTS=$(E2Efooter)
ERRORS_TESTS=$(E2Eerrors)
Expand Down Expand Up @@ -173,9 +169,6 @@ testpermissions:test-PERMISSIONS_TESTS
.PHONY: testrecordset
testrecordset: test-RECORDSET_TESTS

.PHONY: testrecordset-protractor
testrecordset-protractor: test_protractor-RECORDSET_TESTS_PROTRACTOR

#Rule to run the default chaise configuration tests in parallel
.PHONY: testfooter
testfooter: test-FOOTER_TESTS
Expand All @@ -200,9 +193,6 @@ testallfeatures: test-ALL_FEATURES_PARALLEL_TESTS
.PHONY: testallfeaturesconfirmation
testallfeaturesconfirmation: test-ALL_FEATURES_CONFIRMATION_PARALLEL_TESTS

.PHONY: testallfeaturesconfirmation-protractor
testallfeaturesconfirmation-protractor: test_protractor-ALL_FEATURES_CONFIRMATION_PARALLEL_TESTS_PROTRACTOR

#Rule to run the delete prohibited chaise configuration tests in parallel
.PHONY: testdeleteprohibited
testdeleteprohibited: test-DELETE_PROHIBITED_PARALLEL_TESTS
Expand Down
34 changes: 13 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 29 additions & 17 deletions src/components/input-switch/date-time-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const DateTimeField = (props: DateTimeFieldProps): JSX.Element => {

const DATE_TIME_FORMAT = props.hasTimezone ? dataFormats.datetime.return : dataFormats.timestamp;

// since we're showing a manual error, we're also setting the input as this value so the form is also invalid.
const invalidValue = 'invalid-value';

useEffect(() => {
// Set default values if they exists
Expand All @@ -66,45 +68,41 @@ const DateTimeField = (props: DateTimeFieldProps): JSX.Element => {
const datetimeFieldState = getFieldState(props.name);

// if both are missing, the input is empty
if (!dateVal && !timeVal && !props.requiredInput) {
if (!dateVal && !timeVal) {
if (datetimeFieldState.error) clearErrors(props.name);
setValue(props.name, '');
trigger(props.name);
void trigger(props.name);
return;
}

// if date is missing, this is invalid
if (!dateVal) {
setError(props.name, { type: CUSTOM_ERROR_TYPES.INVALID_DATE_TIME, message: ERROR_MESSAGES.INVALID_DATE });
setValue(props.name, 'invalid-value');
setValue(props.name, invalidValue);
return;
}
// otherwise validate the date value
else {
const err = VALIDATE_VALUE_BY_TYPE['date'](dateVal);
if (typeof err === 'string') {
setError(props.name, { type: CUSTOM_ERROR_TYPES.INVALID_DATE_TIME, message: err });
setValue(props.name, 'invalid-value');
setValue(props.name, invalidValue);
return;
}
}

// if only time is missing, use 00:00:00 for it
let timeValTemp = '';
if (!timeVal && !props.requiredInput) {
timeValTemp = '00:00:00';
// if time is missing, use 00:00:00 for it
let usedTimeVal = timeVal;
if (!timeVal) {
usedTimeVal = '00:00:00';
setValue(`${props.name}-time`, usedTimeVal);
}
// otherwise validate the time value
else {
if (!timeVal) {
setError(props.name, { type: CUSTOM_ERROR_TYPES.INVALID_DATE_TIME, message: 'Please enter a valid time' });
setValue(props.name, 'invalid-value');
return;
}
const err = VALIDATE_VALUE_BY_TYPE['time'](timeVal);
if (typeof err === 'string') {
setError(props.name, { type: CUSTOM_ERROR_TYPES.INVALID_DATE_TIME, message: err });
setValue(props.name, 'invalid-value');
setValue(props.name, invalidValue);
return;
}
}
Expand All @@ -115,7 +113,7 @@ const DateTimeField = (props: DateTimeFieldProps): JSX.Element => {
* and have to rely on moment to do this for us.
*/
const date = windowRef.moment(dateVal, dataFormats.date);
const time = windowRef.moment(timeValTemp ? timeValTemp : timeVal, dataFormats.time);
const time = windowRef.moment(usedTimeVal, dataFormats.time);
const dateTime = date.set({
hour: time.get('hour'),
minute: time.get('minute'),
Expand All @@ -129,9 +127,23 @@ const DateTimeField = (props: DateTimeFieldProps): JSX.Element => {

// we have to call trigger to trigger all the validators again
// (needed for the ARRAY_ADD_OR_DISCARD_VALUE error to show up)
trigger(props.name);
void trigger(props.name);

}, [dateVal, timeVal])
}, [dateVal, timeVal]);

/**
* we have to make sure to trigger all the validators after we've manually changed the value.
*
* NOTE:
* - This is needed for the ARRAY_ADD_OR_DISCARD_VALUE error or any other custom validators that we have to show up.
*/
useEffect(() => {
/**
* if we set the value to "invalid value", we also have defined a custom error that we want to show.
* so we're excluding that from here to make sure the custom error is not replaced by a generic one.
*/
if (dateTimeVal !== invalidValue) void trigger(props.name);
}, [dateTimeVal])

const formInputDate = useController({
name: `${props.name}-date`,
Expand Down
4 changes: 2 additions & 2 deletions src/components/input-switch/file-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ const FileField = (props: FileFieldProps): JSX.Element => {
>
<div className='chaise-input-group'>
{renderInput(field.value, showClear, clearInput)}
{!props.disableInput && <ChaiseTooltip placement='bottom' tooltip='Select File'>
{!props.disableInput &&
<div className='chaise-input-group-append' tabIndex={0}>
<label className='chaise-btn chaise-btn-secondary' role='button' htmlFor={fileElementId}>
<span className='fa-solid fa-folder-open'></span>
<span className='button-text'>Select file</span>
</label>
</div>
</ChaiseTooltip>}
}
</div>
</EllipsisWrapper>
{renderImagePreview(field.value)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/navbar/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const ChaiseNavbar = (): JSX.Element => {
const isVersioned = (): boolean => (!!catalogId.split('@')[1]);

useEffect(() => {
const root = { ...cc.navbarMenu } || {};
const root = typeof cc.navbarMenu === 'object' ? { ...cc.navbarMenu } : {};

// if in iframe and we want to force links to open in new tab,
const forceNewTab = settings.openLinksInTab === true;
Expand Down Expand Up @@ -195,7 +195,7 @@ const ChaiseNavbar = (): JSX.Element => {
/**
* Update the state to reflect most recently opened dropdown
*/
setOpenedDropDownIndex(isOpen ? index : undefined);
setOpenedDropDownIndex(isOpen ? index : undefined);

onDropdownToggle(isOpen, event, LogActions.NAVBAR_MENU_OPEN, item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"recordedit/composite-key.config.json",
"recordedit/domain-filter.config.json",
"recordedit/foreign-key-dropdown.config.json",
"recordedit/multi-column-types.config.json",
"recordedit/edit-multi.config.json",
"recordedit/null-values.config.json",
"recordedit/submission-disabled.config.json",

"recordset/add.config.json",
Expand Down
9 changes: 0 additions & 9 deletions test/e2e/data_setup/config/recordedit/edit-multi.dev.json

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"catalog": {},
"schema": {
"name": "multi-edit",
"name": "null-values",
"createNew": true,
"path": "test/e2e/data_setup/schema/recordedit/multi-edit.json"
"path": "test/e2e/data_setup/schema/recordedit/null-values.json"
},
"tables": {
"createNew": true
},
"entities": {
"createNew": true,
"path": "test/e2e/data_setup/data/multi-edit"
"path": "test/e2e/data_setup/data/null-values"
}
}
9 changes: 9 additions & 0 deletions test/e2e/data_setup/config/recordedit/null-values.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"setup": {
"schemaConfigurations": [
"/recordedit/null-values.config.json"
],
"schema": "null-values"
},
"cleanup": true
}
Loading

0 comments on commit db126b0

Please sign in to comment.