Skip to content

Commit ada2d24

Browse files
committed
FAT-26027 Verify Lists query edit preserves IN operator
Automates C446019 for the Lists query builder by creating an Instances list with an Instance UUID IN query, saving the list, reopening Edit query, and verifying the IN operator and matching preview results remain correct. Updates the query modal preview assertions to target the Query returns heading instead of layout classes.
1 parent adabd2d commit ada2d24

2 files changed

Lines changed: 82 additions & 2 deletions

File tree

cypress/e2e/lists/query-builder/search-query-builder-ui.cy.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ describe('Lists', () => {
214214
const recordType = 'Instances';
215215
const testData = {
216216
instanceTitle: getTestEntityValue('C_lists_query_builder_classification_instance'),
217+
uuidInstanceTitles: [
218+
getTestEntityValue('C446019_Instance_1'),
219+
getTestEntityValue('C446019_Instance_2'),
220+
],
221+
instanceIds: [],
217222
classificationNumber: 'BJ1533.C4',
218223
classificationIdentifierTypeName: getTestEntityValue(
219224
'C_lists_query_builder_classification_type',
@@ -243,6 +248,17 @@ describe('Lists', () => {
243248
},
244249
}).then(({ instanceId }) => {
245250
testData.instanceId = instanceId;
251+
testData.instanceIds.push(instanceId);
252+
});
253+
testData.uuidInstanceTitles.forEach((title) => {
254+
InventoryInstances.createFolioInstanceViaApi({
255+
instance: {
256+
instanceTypeId: instanceTypes[0].id,
257+
title,
258+
},
259+
}).then(({ instanceId }) => {
260+
testData.instanceIds.push(instanceId);
261+
});
246262
});
247263
});
248264
createQueryBuilderUser(
@@ -255,6 +271,11 @@ describe('Lists', () => {
255271
cy.getAdminToken();
256272
Users.deleteViaApi(userData.userId);
257273
InventoryInstance.deleteInstanceViaApi(testData.instanceId);
274+
testData.instanceIds
275+
.filter((instanceId) => instanceId !== testData.instanceId)
276+
.forEach((instanceId) => {
277+
InventoryInstance.deleteInstanceViaApi(instanceId);
278+
});
258279
ClassificationIdentifierTypes.deleteViaApi(testData.classificationIdentifierTypeId);
259280
});
260281

@@ -342,6 +363,65 @@ describe('Lists', () => {
342363
},
343364
);
344365

366+
it(
367+
'C446019 The IN operator is rendered correctly in the query builder when editing existing queries (corsair)',
368+
{ tags: ['criticalPath', 'corsair', 'C446019'] },
369+
() => {
370+
const recordAmount = 3;
371+
const instanceIds = testData.instanceIds;
372+
const value = instanceIds.join(',');
373+
const formattedValue = instanceIds.join(', ');
374+
const expectedQuery = `(instance.id in (${formattedValue}))`;
375+
376+
listName = getTestEntityValue('C446019_List');
377+
openQueryBuilder(recordType);
378+
379+
QueryModal.selectField(instanceFieldValues.instanceId);
380+
QueryModal.verifySelectedField(instanceFieldValues.instanceId);
381+
QueryModal.selectOperator(QUERY_OPERATIONS.IN);
382+
QueryModal.fillInValueTextfield(value);
383+
QueryModal.verifyTextFieldValue(value);
384+
QueryModal.verifyQueryAreaContent(expectedQuery);
385+
QueryModal.testQueryDisabled(false);
386+
QueryModal.runQueryDisabled();
387+
388+
QueryModal.clickTestQuery();
389+
QueryModal.verifyPreviewOfRecordsMatched();
390+
QueryModal.verifyNumberOfMatchedRecords(recordAmount);
391+
instanceIds.forEach((instanceId) => {
392+
QueryModal.verifyRecordWithContent(instanceId);
393+
});
394+
395+
QueryModal.clickRunQueryAndSave();
396+
QueryModal.verifyClosed();
397+
Lists.verifySuccessCalloutMessage(`List ${listName} saved.`);
398+
Lists.waitForCompilingAnimationToDisappear();
399+
Lists.verifyRefreshCompleteCallout(recordAmount);
400+
Lists.viewUpdatedList();
401+
Lists.verifyRecordsNumber(recordAmount);
402+
instanceIds.forEach((instanceId) => {
403+
Lists.verifyRecordWithContent(instanceId);
404+
});
405+
406+
Lists.openActions();
407+
Lists.editList();
408+
Lists.editQuery();
409+
QueryModal.verifySelectedField(instanceFieldValues.instanceId);
410+
QueryModal.verifySelectedOperator(QUERY_OPERATIONS.IN);
411+
QueryModal.verifyTextFieldValue(value);
412+
QueryModal.verifyQueryAreaDoesNotContain('undefined');
413+
QueryModal.testQueryDisabled(false);
414+
QueryModal.runQueryDisabled();
415+
416+
QueryModal.clickTestQuery();
417+
QueryModal.verifyPreviewOfRecordsMatched();
418+
QueryModal.verifyNumberOfMatchedRecords(recordAmount);
419+
instanceIds.forEach((instanceId) => {
420+
QueryModal.verifyRecordWithContent(instanceId);
421+
});
422+
},
423+
);
424+
345425
it(
346426
'Search instances in the query builder by classification identifier type (corsair)',
347427
{ tags: ['criticalPath', 'corsair'] },

cypress/support/fragments/bulk-edit/query-modal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ export default {
750750
this.testQueryDisabled(false);
751751
this.cancelDisabled(false);
752752
this.runQueryDisabled(false);
753-
cy.get('[class^="col-xs-10"]').then(($element) => {
753+
cy.contains('h3', /^Query returns/).then(($element) => {
754754
cy.wrap($element)
755755
.invoke('text')
756756
.then((text) => {
@@ -870,7 +870,7 @@ export default {
870870

871871
verifyNumberOfMatchedRecords(numberOfMatchedRecords) {
872872
cy.wait(3000);
873-
cy.get('[class^="col-xs-10"]').then(($element) => {
873+
cy.contains('h3', /^Query returns/).then(($element) => {
874874
cy.wrap($element)
875875
.invoke('text')
876876
.then((text) => {

0 commit comments

Comments
 (0)