@@ -330,5 +330,131 @@ describe('Integration Tests', () => {
330330 expect ( results [ 0 ] . title ) . toBe ( 'StepWright Test Page' ) ;
331331 expect ( results [ 0 ] . page_title ) . toBe ( 'StepWright Test Page' ) ;
332332 } ) ;
333+
334+ it ( 'should handle wait action with value property' , async ( ) => {
335+ const templates :TabTemplate [ ] = [
336+ {
337+ tab : 'wait_test' ,
338+ steps : [
339+ {
340+ id : 'navigate' ,
341+ action : 'navigate' ,
342+ value : testPageUrl
343+ } ,
344+ {
345+ id : 'wait_before_extraction' ,
346+ action : 'wait' ,
347+ value : '500'
348+ } ,
349+ {
350+ id : 'get_title' ,
351+ action : 'data' ,
352+ object_type : 'id' ,
353+ object : 'main-title' ,
354+ key : 'title' ,
355+ data_type : 'text'
356+ }
357+ ]
358+ }
359+ ] ;
360+
361+ const startTime = Date . now ( ) ;
362+ const results = await runScraper ( templates ) ;
363+ const endTime = Date . now ( ) ;
364+ const duration = endTime - startTime ;
365+
366+ expect ( results ) . toHaveLength ( 1 ) ;
367+ expect ( results [ 0 ] . title ) . toBe ( 'StepWright Test Page' ) ;
368+ // Verify that wait actually occurred (allowing some margin for test execution)
369+ expect ( duration ) . toBeGreaterThanOrEqual ( 400 ) ;
370+ } ) ;
371+
372+ it ( 'should handle wait action with wait property' , async ( ) => {
373+ const templates :TabTemplate [ ] = [
374+ {
375+ tab : 'wait_test_wait_prop' ,
376+ steps : [
377+ {
378+ id : 'navigate' ,
379+ action : 'navigate' ,
380+ value : testPageUrl
381+ } ,
382+ {
383+ id : 'wait_before_extraction' ,
384+ action : 'wait' ,
385+ wait : 300
386+ } ,
387+ {
388+ id : 'get_title' ,
389+ action : 'data' ,
390+ object_type : 'id' ,
391+ object : 'main-title' ,
392+ key : 'title' ,
393+ data_type : 'text'
394+ }
395+ ]
396+ }
397+ ] ;
398+
399+ const startTime = Date . now ( ) ;
400+ const results = await runScraper ( templates ) ;
401+ const endTime = Date . now ( ) ;
402+ const duration = endTime - startTime ;
403+
404+ expect ( results ) . toHaveLength ( 1 ) ;
405+ expect ( results [ 0 ] . title ) . toBe ( 'StepWright Test Page' ) ;
406+ // Verify that wait actually occurred (allowing some margin for test execution)
407+ expect ( duration ) . toBeGreaterThanOrEqual ( 200 ) ;
408+ } ) ;
409+
410+ it ( 'should handle wait action in sequence with other actions' , async ( ) => {
411+ const templates :TabTemplate [ ] = [
412+ {
413+ tab : 'wait_sequence_test' ,
414+ steps : [
415+ {
416+ id : 'navigate' ,
417+ action : 'navigate' ,
418+ value : testPageUrl
419+ } ,
420+ {
421+ id : 'wait_after_navigate' ,
422+ action : 'wait' ,
423+ value : '200'
424+ } ,
425+ {
426+ id : 'fill_search' ,
427+ action : 'input' ,
428+ object_type : 'id' ,
429+ object : 'search-box' ,
430+ value : 'test search'
431+ } ,
432+ {
433+ id : 'wait_after_input' ,
434+ action : 'wait' ,
435+ value : '200'
436+ } ,
437+ {
438+ id : 'get_search_value' ,
439+ action : 'data' ,
440+ object_type : 'id' ,
441+ object : 'search-box' ,
442+ key : 'search_value' ,
443+ data_type : 'value'
444+ }
445+ ]
446+ }
447+ ] ;
448+
449+ const startTime = Date . now ( ) ;
450+ const results = await runScraper ( templates ) ;
451+ const endTime = Date . now ( ) ;
452+ const duration = endTime - startTime ;
453+
454+ expect ( results ) . toHaveLength ( 1 ) ;
455+ expect ( results [ 0 ] . search_value ) . toBe ( 'test search' ) ;
456+ // Verify that waits occurred (allowing some margin for test execution)
457+ expect ( duration ) . toBeGreaterThanOrEqual ( 300 ) ;
458+ } ) ;
333459 } ) ;
334460} ) ;
0 commit comments