mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-04 20:49:54 +00:00
Fix the advanced search AUT failing due to page closed (#23904)
This commit is contained in:
parent
4942e2bdfb
commit
a27d36f41f
@ -537,6 +537,12 @@ export const checkAddRuleOrGroupWithOperator = async (
|
|||||||
.click();
|
.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since the OR operator with must not conditions will result in huge API response
|
||||||
|
// with huge data, checking the required criteria might not be present on first page
|
||||||
|
// Hence, checking the criteria only for AND operator
|
||||||
|
if (field.id === 'Column') {
|
||||||
|
await page.getByTestId('apply-btn').click();
|
||||||
|
} else {
|
||||||
const searchRes = page.waitForResponse(
|
const searchRes = page.waitForResponse(
|
||||||
`/api/v1/search/query?*index=dataAsset&from=0&size=15*${getEncodedFqn(
|
`/api/v1/search/query?*index=dataAsset&from=0&size=15*${getEncodedFqn(
|
||||||
searchCriteria1.toLowerCase(),
|
searchCriteria1.toLowerCase(),
|
||||||
@ -544,17 +550,20 @@ export const checkAddRuleOrGroupWithOperator = async (
|
|||||||
)}*${getEncodedFqn(searchCriteria2.toLowerCase(), true)}*`
|
)}*${getEncodedFqn(searchCriteria2.toLowerCase(), true)}*`
|
||||||
);
|
);
|
||||||
await page.getByTestId('apply-btn').click();
|
await page.getByTestId('apply-btn').click();
|
||||||
|
|
||||||
// Since the OR operator with must not conditions will result in huge API response
|
|
||||||
// with huge data, checking the required criteria might not be present on first page
|
|
||||||
// Hence, checking the criteria only for AND operator
|
|
||||||
if (field.id !== 'Column' && operator === 'AND') {
|
|
||||||
const res = await searchRes;
|
const res = await searchRes;
|
||||||
const json = await res.json();
|
const json = await res.json();
|
||||||
const hits = json.hits.hits;
|
const hits = json.hits.hits;
|
||||||
|
|
||||||
|
if (operator === 'AND') {
|
||||||
expect(JSON.stringify(hits)).toContain(searchCriteria1);
|
expect(JSON.stringify(hits)).toContain(searchCriteria1);
|
||||||
expect(JSON.stringify(hits)).not.toContain(searchCriteria2);
|
expect(JSON.stringify(hits)).not.toContain(searchCriteria2);
|
||||||
|
} else {
|
||||||
|
const hitsString = JSON.stringify(hits);
|
||||||
|
const containsCriteria1 = hitsString.includes(searchCriteria1);
|
||||||
|
const containsCriteria2 = hitsString.includes(searchCriteria2);
|
||||||
|
|
||||||
|
expect(containsCriteria1 || !containsCriteria2).toBe(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user