mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	Fix the advanced search AUT failing due to page closed (#23904)
This commit is contained in:
		
							parent
							
								
									4942e2bdfb
								
							
						
					
					
						commit
						a27d36f41f
					
				| @ -537,24 +537,33 @@ export const checkAddRuleOrGroupWithOperator = async ( | |||||||
|       .click(); |       .click(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   const searchRes = page.waitForResponse( |  | ||||||
|     `/api/v1/search/query?*index=dataAsset&from=0&size=15*${getEncodedFqn( |  | ||||||
|       searchCriteria1.toLowerCase(), |  | ||||||
|       true |  | ||||||
|     )}*${getEncodedFqn(searchCriteria2.toLowerCase(), true)}*` |  | ||||||
|   ); |  | ||||||
|   await page.getByTestId('apply-btn').click(); |  | ||||||
| 
 |  | ||||||
|   // Since the OR operator with must not conditions will result in huge API response
 |   // 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
 |   // with huge data, checking the required criteria might not be present on first page
 | ||||||
|   // Hence, checking the criteria only for AND operator
 |   // Hence, checking the criteria only for AND operator
 | ||||||
|   if (field.id !== 'Column' && operator === 'AND') { |   if (field.id === 'Column') { | ||||||
|  |     await page.getByTestId('apply-btn').click(); | ||||||
|  |   } else { | ||||||
|  |     const searchRes = page.waitForResponse( | ||||||
|  |       `/api/v1/search/query?*index=dataAsset&from=0&size=15*${getEncodedFqn( | ||||||
|  |         searchCriteria1.toLowerCase(), | ||||||
|  |         true | ||||||
|  |       )}*${getEncodedFqn(searchCriteria2.toLowerCase(), true)}*` | ||||||
|  |     ); | ||||||
|  |     await page.getByTestId('apply-btn').click(); | ||||||
|     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; | ||||||
| 
 | 
 | ||||||
|     expect(JSON.stringify(hits)).toContain(searchCriteria1); |     if (operator === 'AND') { | ||||||
|     expect(JSON.stringify(hits)).not.toContain(searchCriteria2); |       expect(JSON.stringify(hits)).toContain(searchCriteria1); | ||||||
|  |       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
	 Aniket Katkar
						Aniket Katkar