@@ -47,7 +47,7 @@ test('conduct test', async () => {
4747 expect ( getTestFunction ( suite , 2 ) ) . toHaveProperty ( 'title' , 'failing test' )
4848 expect ( getTestFunction ( suite , 2 ) . result . get ( ) ) . toHaveProperty ( 'type' , 'fail' )
4949
50- expect ( ( await ( await conductor . browser ) . pages ( ) ) . length ) . toBe ( 0 )
50+ expect ( ( await ( await conductor . browser ) . pages ( ) ) . length ) . toBe ( 1 )
5151} , generousTimeout )
5252
5353test ( 'abort test' , async ( ) => {
@@ -73,3 +73,19 @@ test('abort test', async () => {
7373 expect ( getTestFunction ( suite , 1 ) . result . get ( ) ) . toHaveProperty ( 'type' , 'success' )
7474 expect ( getTestFunction ( suite , 2 ) . result . get ( ) ) . toBe ( undefined )
7575} , generousTimeout )
76+
77+ test ( 'document is hidden' , async ( ) => {
78+ const { conductor, fileServer} = await setupConductor ( )
79+ fileServer . provider . files . set ( 'checkVisibility.js' , Promise . resolve ( { content : `
80+ if (document.visibilityState !== 'hidden') {
81+ throw new Error('document.visibilityState is: ' + document.visibilityState)
82+ }
83+ ` } ) )
84+ const suiteUrl = String ( await fileServer . url ) + 'checkVisibility.js'
85+ const run = createTestRun ( [ conductor ] , [ { url : suiteUrl , title : 'visibilityState' } ] )
86+ const suite = run . runs . get ( conductor ) ! . suites . get ( suiteUrl ) !
87+
88+ await suite . exec ( ) . catch ( ( ) => void 0 )
89+
90+ expect ( suite . errors [ Symbol . iterator ] ( ) . next ( ) . value ?. message ) . toBe ( undefined )
91+ } )
0 commit comments