1111 * limitations under the License.
1212 */
1313import test , { expect , Page , Response } from '@playwright/test' ;
14+ import { PLAYWRIGHT_BASIC_TEST_TAG_OBJ } from '../../constant/config' ;
1415import { GlobalSettingOptions } from '../../constant/settings' ;
1516import {
1617 clickOutside ,
@@ -126,7 +127,7 @@ const verifyLastExecutionStatus = async (page: Page) => {
126127
127128 await page . reload ( ) ;
128129
129- await page . waitForSelector ( '[data-testid=" app-run-history-table"]' ) ;
130+ await page . getByTestId ( ' app-run-history-table' ) . waitFor ( ) ;
130131
131132 await expect ( page . getByTestId ( 'pipeline-status' ) ) . toContainText ( 'Success' ) ;
132133} ;
@@ -147,8 +148,9 @@ const verifyLastExecutionRun = async (page: Page, response: Response) => {
147148 }
148149} ;
149150
150- test ( 'Search Index Application' , async ( { page } ) => {
151- test . slow ( ) ;
151+ test . describe ( 'Search Index Application' , PLAYWRIGHT_BASIC_TEST_TAG_OBJ , ( ) => {
152+ test ( 'Search Index Application' , async ( { page } ) => {
153+ test . slow ( ) ;
152154
153155 await test . step ( 'Visit Application page' , async ( ) => {
154156 await redirectToHomePage ( page ) ;
@@ -178,178 +180,16 @@ test('Search Index Application', async ({ page }) => {
178180
179181 await settingClick ( page , GlobalSettingOptions . APPLICATIONS ) ;
180182 } ) ;
181- } ) ;
182-
183- await test . step ( 'Edit application' , async ( ) => {
184- await page . click ( '[data-testid="edit-button"]' ) ;
185- await page . waitForSelector ( '[data-testid="schedular-card-container"]' ) ;
186- await page
187- . getByTestId ( 'schedular-card-container' )
188- . getByText ( 'On Demand' )
189- . click ( ) ;
190-
191- const deployResponse = page . waitForResponse ( '/api/v1/apps/*' ) ;
192- await page . click ( '.ant-modal-body [data-testid="deploy-button"]' ) ;
193- await deployResponse ;
194-
195- await toastNotification ( page , 'Schedule saved successfully' ) ;
196-
197- expect ( await page . innerText ( '[data-testid="schedule-type"]' ) ) . toContain (
198- 'None'
199- ) ;
200-
201- await page . click ( '[data-testid="configuration"]' ) ;
202- await page . waitForLoadState ( 'networkidle' ) ;
203-
204- await expect ( page . locator ( '#search-indexing-application' ) ) . toContainText (
205- 'Search Indexing Application'
206- ) ;
207-
208- await expect ( page . locator ( 'form' ) ) . toContainText ( 'Auto Tune' ) ;
209-
210- await page . fill ( '#root\\/batchSize' , '100' ) ;
211-
212- await page . getByTestId ( 'tree-select-widget' ) . click ( ) ;
213-
214- // Bring table option to view in dropdown via searching for it
215- await page
216- . getByTestId ( 'tree-select-widget' )
217- . getByRole ( 'combobox' )
218- . fill ( 'Table' ) ;
219-
220- // uncheck the entity
221- await page . getByRole ( 'tree' ) . getByTitle ( 'Table' ) . click ( ) ;
222-
223- // Need an outside click to close the dropdown
224- await clickOutside ( page ) ;
225- await page . locator ( '[for="root/searchIndexMappingLanguage"]' ) . click ( ) ;
226-
227- await page
228- . getByTestId ( 'select-widget-root/searchIndexMappingLanguage' )
229- . click ( ) ;
230-
231- await expect ( page . getByTestId ( 'select-option-JP' ) ) . toBeVisible ( ) ;
232-
233- await page . getByTestId ( 'select-option-JP' ) . click ( ) ;
234-
235- const responseAfterSubmit = page . waitForResponse ( '/api/v1/apps/*' ) ;
236- await page . click ( '[data-testid="submit-btn"]' ) ;
237- await responseAfterSubmit ;
238-
239- await toastNotification ( page , 'Configuration saved successfully' ) ;
240- } ) ;
241-
242- await test . step ( 'Uninstall application' , async ( ) => {
243- await page . click ( '[data-testid="manage-button"]' ) ;
244- await page . click ( '[data-testid="uninstall-button-title"]' ) ;
245-
246- const deleteRequest = page . waitForResponse (
247- '/api/v1/apps/name/SearchIndexingApplication?hardDelete=true'
248- ) ;
249- await page . click ( '[data-testid="save-button"]' ) ;
250- await deleteRequest ;
251-
252- await toastNotification ( page , 'Application uninstalled successfully' ) ;
253-
254- const card1 = page . locator (
255- '[data-testid="search-indexing-application-card"]'
256- ) ;
257-
258- expect ( await card1 . isVisible ( ) ) . toBe ( false ) ;
259- } ) ;
260-
261- await test . step ( 'Install application' , async ( ) => {
262- // Verify response status code
263- const getMarketPlaceResponse = page . waitForResponse (
264- '/api/v1/apps/marketplace?limit=15'
265- ) ;
266- await page . click ( '[data-testid="add-application"]' ) ;
267-
268- const response = await getMarketPlaceResponse ;
269-
270- expect ( response . status ( ) ) . toBe ( 200 ) ;
271-
272- // Check if search-indexing-application-card is visible, if not paginate through pages
273- let cardFound = await page
274- . locator ( '[data-testid="search-indexing-application-card"]' )
275- . isVisible ( ) ;
276-
277- while ( ! cardFound ) {
278- const nextButton = page . locator ( '[data-testid="next"]' ) ;
279- const isNextButtonDisabled = await nextButton . isDisabled ( ) ;
280-
281- if ( isNextButtonDisabled ) {
282- throw new Error (
283- 'search-indexing-application-card not found in marketplace and next button is disabled'
284- ) ;
285- }
286-
287- // Click next page and wait for response
288- const nextPageResponse = page . waitForResponse (
289- '/api/v1/apps/marketplace*'
290- ) ;
291- await nextButton . click ( ) ;
292- await nextPageResponse ;
293-
294- // Check if card is now visible
295- cardFound = await page
296- . locator ( '[data-testid="search-indexing-application-card"]' )
297- . isVisible ( ) ;
298- }
299-
300- await page . click (
301- '[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
302- ) ;
303- await page . click ( '[data-testid="install-application"]' ) ;
304- await page . click ( '[data-testid="save-button"]' ) ;
305- await page . click ( '[data-testid="submit-btn"]' ) ;
306- await page . waitForSelector ( '[data-testid="schedular-card-container"]' ) ;
307- await page
308- . getByTestId ( 'schedular-card-container' )
309- . getByText ( 'On Demand' )
310- . click ( ) ;
311-
312- await expect ( page . locator ( '[data-testid="cron-type"]' ) ) . not . toBeVisible ( ) ;
313-
314- const installApplicationResponse = page . waitForResponse ( 'api/v1/apps' ) ;
315- const getApplications = page . waitForRequest (
316- ( request ) =>
317- request . url ( ) . includes ( '/api/v1/apps?limit' ) &&
318- request . method ( ) === 'GET'
319- ) ;
320- await page . click ( '[data-testid="deploy-button"]' ) ;
321- await installApplicationResponse ;
322-
323- await toastNotification ( page , 'Application installed successfully' ) ;
324-
325- await getApplications ;
326-
327- await expect (
328- page . getByTestId ( 'search-indexing-application-card' )
329- ) . toBeVisible ( ) ;
330- } ) ;
331-
332- if ( process . env . PLAYWRIGHT_IS_OSS ) {
333- await test . step ( 'Run application' , async ( ) => {
334- test . slow ( true ) ; // Test time shouldn't exceed while re-fetching the history API.
335-
336- await page . click (
337- '[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
338- ) ;
339-
340- const triggerPipelineResponse = page . waitForResponse (
341- '/api/v1/apps/trigger/SearchIndexingApplication'
342- ) ;
343- await page . click ( '[data-testid="run-now-button"]' ) ;
344-
345- await triggerPipelineResponse ;
346-
347- await toastNotification ( page , 'Application triggered successfully' ) ;
348183
184+ await test . step ( 'Verify last execution run' , async ( ) => {
349185 const statusAPI = page . waitForResponse (
350186 '/api/v1/apps/name/SearchIndexingApplication/status?offset=0&limit=1'
351187 ) ;
352- await page . reload ( ) ;
188+ await page
189+ . locator (
190+ '[data-testid="search-indexing-application-card"] [data-testid="config-btn"]'
191+ )
192+ . click ( ) ;
353193 const statusResponse = await statusAPI ;
354194
355195 expect ( statusResponse . status ( ) ) . toBe ( 200 ) ;
@@ -483,4 +323,4 @@ test('Search Index Application', async ({ page }) => {
483323 } ) ;
484324 }
485325 } ) ;
486- } ) ;
326+ } ) ;
0 commit comments