@@ -2,29 +2,30 @@ import { $ } from '@wdio/globals'
22import { setOptions , getConfig } from 'expect-webdriverio'
33
44describe ( 'Global Options' , ( ) => {
5+ const defaultWait = getConfig ( ) . wait
56
67 before ( ( ) => {
7- // Verify we can set the option to 1ms
88 setOptions ( { wait : 1 } )
9+ } )
10+
11+ it ( 'should set global wait option' , ( ) => {
912 expect ( getConfig ( ) . wait ) . toBe ( 1 )
13+ expect ( getConfig ( ) . wait ) . not . toBe ( defaultWait )
14+ expect ( defaultWait ) . toBe ( 10000 )
1015 } )
1116
1217 it ( 'should allow setting and using global wait option' , async ( ) => {
1318 const start = Date . now ( )
1419
15- // This should fail almost immediately because the element doesn't exist
16- // and the wait time is set to 1ms
20+ // Should fail immediately (wait: 1ms)
1721 await expect ( expect ( $ ( 'non-existent-element-' + Date . now ( ) ) ) . toBeDisplayed ( ) ) . rejects . toThrow ( )
1822 const duration = Date . now ( ) - start
1923
20- // It should take significantly less time than the default or the 250ms set in wdio.conf
21- // 1ms wait + overhead. 500ms should be a safe upper bound for "immediate" failure
22- // vs a standard 3000ms timeout
24+ // Ensure failure was fast (< 500ms) compared to default timeout
2325 expect ( duration ) . toBeLessThan ( 500 )
2426 } )
2527
2628 after ( ( ) => {
27- // Restore the option to 250ms as inferred from wdio.conf.ts to not pollute other tests
28- setOptions ( { wait : 250 } )
29+ setOptions ( { wait : defaultWait } )
2930 } )
3031} )
0 commit comments