@@ -70,17 +70,17 @@ test.describe('Glossary tests', () => {
7070 test ( 'should check for glossary term search' , async ( { page } ) => {
7171 test . slow ( true ) ;
7272
73- glossary . visitEntityPage ( page ) ;
73+ await glossary . visitEntityPage ( page ) ;
7474
7575 // Wait for terms to load
7676 await page . waitForSelector ( '[data-testid="glossary-terms-table"]' ) ;
7777
7878 // Test 1: Search for specific term
7979 const searchInput = page . getByPlaceholder ( / s e a r c h .* t e r m / i) ;
80+ const searchResponse = page . waitForResponse ( '**/api/v1/glossaryTerms/search?*' ) ;
8081 await searchInput . fill ( 'SearchTestTerm5' ) ;
8182
82- // Wait for search API call with new endpoint
83- await page . waitForResponse ( 'api/v1/glossaryTerms/search?*' ) ;
83+ await searchResponse ;
8484 const table = page . getByTestId ( 'glossary-terms-table' ) ;
8585 const filteredTerms = await table . locator ( 'tbody .ant-table-row' ) . count ( ) ;
8686
@@ -94,12 +94,13 @@ test.describe('Glossary tests', () => {
9494 ) . not . toBeVisible ( ) ;
9595
9696 // Test 2: Partial search
97+ const clearResponse = page . waitForResponse ( '**/api/v1/glossaryTerms?*' ) ;
9798 await searchInput . clear ( ) ;
98- await page . waitForResponse ( 'api/v1/glossaryTerms?*' ) ;
99+ await clearResponse ;
99100
101+ const partialSearchResponse = page . waitForResponse ( '**/api/v1/glossaryTerms/search?*' ) ;
100102 await searchInput . fill ( 'TestTerm' ) ;
101-
102- await page . waitForResponse ( 'api/v1/glossaryTerms/search?*' ) ;
103+ await partialSearchResponse ;
103104
104105 const partialFilteredTerms = await table
105106 . locator ( 'tbody .ant-table-row' )
@@ -108,8 +109,9 @@ test.describe('Glossary tests', () => {
108109 expect ( partialFilteredTerms ) . toBeGreaterThan ( 0 ) ;
109110
110111 // Test 3: Clear search and verify all terms are shown
112+ const clearResponse2 = page . waitForResponse ( '**/api/v1/glossaryTerms?*' ) ;
111113 await searchInput . clear ( ) ;
112- await page . waitForResponse ( 'api/v1/glossaryTerms?*' ) ;
114+ await clearResponse2 ;
113115
114116 // Verify terms are visible again
115117 await expect ( page . getByTestId ( 'glossary-terms-table' ) ) . toBeVisible ( ) ;
@@ -134,10 +136,10 @@ test.describe('Glossary tests', () => {
134136
135137 // Test 1: Search within parent term for child terms
136138 const searchInput = page . getByPlaceholder ( / s e a r c h .* t e r m / i) ;
139+ const searchRes1 = page . waitForResponse ( '**/api/v1/glossaryTerms/search?*' ) ;
137140 await searchInput . fill ( 'ChildSearchTerm' ) ;
141+ await searchRes1 ;
138142
139- // Wait for search API call with parent filter
140- await page . waitForResponse ( 'api/v1/glossaryTerms/search?*' ) ;
141143 const nestedTable = page . getByTestId ( 'glossary-terms-table' ) ;
142144 const filteredTerms = await nestedTable
143145 . locator ( 'tbody .ant-table-row' )
@@ -158,19 +160,22 @@ test.describe('Glossary tests', () => {
158160 ) . not . toBeVisible ( ) ;
159161
160162 // Test 2: Search for specific child term
163+ const clearRes1 = page . waitForResponse ( '**/api/v1/glossaryTerms?*' ) ;
161164 await searchInput . clear ( ) ;
162- await page . waitForResponse ( 'api/v1/glossaryTerms?*' ) ;
163- await searchInput . fill ( 'ChildSearchTerm3' ) ;
165+ await clearRes1 ;
164166
165- await page . waitForResponse ( 'api/v1/glossaryTerms/search?*' ) ;
167+ const searchRes2 = page . waitForResponse ( '**/api/v1/glossaryTerms/search?*' ) ;
168+ await searchInput . fill ( 'ChildSearchTerm3' ) ;
169+ await searchRes2 ;
166170
167171 await expect (
168172 page . getByText ( 'ChildSearchTerm3' , { exact : true } )
169173 ) . toBeVisible ( ) ;
170174
171175 // Clear search
176+ const clearRes2 = page . waitForResponse ( '**/api/v1/glossaryTerms?*' ) ;
172177 await searchInput . clear ( ) ;
173- await page . waitForResponse ( 'api/v1/glossaryTerms?*' ) ;
178+ await clearRes2 ;
174179 } ) ;
175180
176181 // S-S03: Search is case-insensitive
@@ -183,41 +188,44 @@ test.describe('Glossary tests', () => {
183188 const searchInput = page . getByPlaceholder ( / s e a r c h .* t e r m / i) ;
184189
185190 // Search with lowercase
191+ const lowerRes = page . waitForResponse ( '**/api/v1/glossaryTerms/search?*' ) ;
186192 await searchInput . fill ( 'searchtestterm5' ) ;
187- await page . waitForResponse ( 'api/v1/glossaryTerms/search?*' ) ;
193+ await lowerRes ;
188194
189- // Should find the term despite case difference
190195 await expect (
191196 page . getByText ( 'SearchTestTerm5' , { exact : true } )
192197 ) . toBeVisible ( ) ;
193198
194199 // Clear and search with uppercase
200+ const clearRes1 = page . waitForResponse ( '**/api/v1/glossaryTerms?*' ) ;
195201 await searchInput . clear ( ) ;
196- await page . waitForResponse ( 'api/v1/glossaryTerms?*' ) ;
202+ await clearRes1 ;
197203
204+ const upperRes = page . waitForResponse ( '**/api/v1/glossaryTerms/search?*' ) ;
198205 await searchInput . fill ( 'SEARCHTESTTERM5' ) ;
199- await page . waitForResponse ( 'api/v1/glossaryTerms/search?*' ) ;
206+ await upperRes ;
200207
201- // Should still find the term
202208 await expect (
203209 page . getByText ( 'SearchTestTerm5' , { exact : true } )
204210 ) . toBeVisible ( ) ;
205211
206212 // Clear and search with mixed case
213+ const clearRes2 = page . waitForResponse ( '**/api/v1/glossaryTerms?*' ) ;
207214 await searchInput . clear ( ) ;
208- await page . waitForResponse ( 'api/v1/glossaryTerms?*' ) ;
215+ await clearRes2 ;
209216
217+ const mixedRes = page . waitForResponse ( '**/api/v1/glossaryTerms/search?*' ) ;
210218 await searchInput . fill ( 'SeArChTeStTeRm5' ) ;
211- await page . waitForResponse ( 'api/v1/glossaryTerms/search?*' ) ;
219+ await mixedRes ;
212220
213- // Should still find the term
214221 await expect (
215222 page . getByText ( 'SearchTestTerm5' , { exact : true } )
216223 ) . toBeVisible ( ) ;
217224
218225 // Clear search
226+ const clearRes3 = page . waitForResponse ( '**/api/v1/glossaryTerms?*' ) ;
219227 await searchInput . clear ( ) ;
220- await page . waitForResponse ( 'api/v1/glossaryTerms?*' ) ;
228+ await clearRes3 ;
221229 } ) ;
222230
223231 // S-S07: Search no results - empty state
@@ -232,15 +240,17 @@ test.describe('Glossary tests', () => {
232240 const searchInput = page . getByPlaceholder ( / s e a r c h .* t e r m / i) ;
233241
234242 // Search for a term that doesn't exist
243+ const noResultsRes = page . waitForResponse ( '**/api/v1/glossaryTerms/search?*' ) ;
235244 await searchInput . fill ( 'NonExistentTermXYZ12345' ) ;
236- await page . waitForResponse ( 'api/v1/glossaryTerms/search?*' ) ;
245+ await noResultsRes ;
237246
238247 // Verify empty state message is shown (uses ErrorPlaceHolder component)
239248 await expect ( page . getByTestId ( 'no-data-placeholder' ) ) . toBeVisible ( ) ;
240249
241250 // Clear search and verify terms return
251+ const clearRes = page . waitForResponse ( '**/api/v1/glossaryTerms?*' ) ;
242252 await searchInput . clear ( ) ;
243- await page . waitForResponse ( 'api/v1/glossaryTerms?*' ) ;
253+ await clearRes ;
244254
245255 // Verify terms are visible again after clearing search
246256 await expect ( page . getByTestId ( 'no-data-placeholder' ) ) . not . toBeVisible ( ) ;
@@ -270,7 +280,6 @@ test.describe('Glossary tests', () => {
270280 await saveButton . click ( ) ;
271281
272282 // Verify filter is applied (may show no results if no InReview terms exist)
273- await page . waitForLoadState ( 'networkidle' ) ;
274283
275284 // The filter should be applied - either showing InReview terms or empty state
276285 const table = page . getByTestId ( 'glossary-terms-table' ) ;
@@ -310,7 +319,6 @@ test.describe('Glossary tests', () => {
310319 await saveButton . click ( ) ;
311320
312321 // Wait for filter to apply
313- await page . waitForLoadState ( 'networkidle' ) ;
314322
315323 // Verify filtered results
316324 const table = page . getByTestId ( 'glossary-terms-table' ) ;
0 commit comments