@@ -675,47 +675,58 @@ playwright.chromium.launch().then(async browser => {
675
675
}
676
676
}
677
677
678
+ type AssertCanBeNull < T > = null extends T ? true : false
679
+
678
680
const frameLikes = [ page , frame ] ;
679
681
for ( const frameLike of frameLikes ) {
680
682
{
681
683
const handle = await frameLike . waitForSelector ( 'body' ) ;
684
+ const bodyAssertion : AssertType < playwright . ElementHandle < HTMLBodyElement > , typeof handle > = true ;
685
+ const canBeNull : AssertCanBeNull < typeof handle > = false
686
+ }
687
+ {
688
+ const handle = await frameLike . waitForSelector ( 'body' , { timeout : 0 } ) ;
682
689
const bodyAssertion : AssertType < playwright . ElementHandle < HTMLBodyElement > , typeof handle > = true ;
683
- const canBeNull : AssertType < null , typeof handle > = false ;
690
+ const canBeNull : AssertCanBeNull < typeof handle > = false ;
684
691
}
685
692
{
686
693
const state = Math . random ( ) > .5 ? 'attached' : 'visible' ;
687
694
const handle = await frameLike . waitForSelector ( 'body' , { state} ) ;
688
695
const bodyAssertion : AssertType < playwright . ElementHandle < HTMLBodyElement > , typeof handle > = true ;
689
- const canBeNull : AssertType < null , typeof handle > = false ;
696
+ const canBeNull : AssertCanBeNull < typeof handle > = false ;
690
697
}
691
698
{
692
699
const handle = await frameLike . waitForSelector ( 'body' , { state : 'hidden' } ) ;
693
700
const bodyAssertion : AssertType < playwright . ElementHandle < HTMLBodyElement > , typeof handle > = true ;
694
- const canBeNull : AssertType < null , typeof handle > = true ;
701
+ const canBeNull : AssertCanBeNull < typeof handle > = true ;
695
702
}
696
703
{
697
704
const state = Math . random ( ) > .5 ? 'hidden' : 'visible' ;
698
705
const handle = await frameLike . waitForSelector ( 'body' , { state} ) ;
699
706
const bodyAssertion : AssertType < playwright . ElementHandle < HTMLBodyElement > , typeof handle > = true ;
700
- const canBeNull : AssertType < null , typeof handle > = true ;
707
+ const canBeNull : AssertCanBeNull < typeof handle > = true ;
701
708
}
702
-
703
709
{
704
710
const handle = await frameLike . waitForSelector ( 'something-strange' ) ;
705
711
const elementAssertion : AssertType < playwright . ElementHandle < HTMLElement | SVGElement > , typeof handle > = true ;
706
- const canBeNull : AssertType < null , typeof handle > = false ;
712
+ const canBeNull : AssertCanBeNull < typeof handle > = false ;
707
713
}
714
+ {
715
+ const handle = await frameLike . waitForSelector ( 'something-strange' , { timeout : 0 } ) ;
716
+ const elementAssertion : AssertType < playwright . ElementHandle < HTMLElement | SVGElement > , typeof handle > = true ;
717
+ const canBeNull : AssertCanBeNull < typeof handle > = false ;
718
+ }
708
719
{
709
720
const state = Math . random ( ) > .5 ? 'attached' : 'visible' ;
710
721
const handle = await frameLike . waitForSelector ( 'something-strange' , { state} ) ;
711
722
const elementAssertion : AssertType < playwright . ElementHandle < HTMLElement | SVGElement > , typeof handle > = true ;
712
- const canBeNull : AssertType < null , typeof handle > = false ;
723
+ const canBeNull : AssertCanBeNull < typeof handle > = false ;
713
724
}
714
725
{
715
726
const state = Math . random ( ) > .5 ? 'hidden' : 'visible' ;
716
727
const handle = await frameLike . waitForSelector ( 'something-strange' , { state} ) ;
717
728
const elementAssertion : AssertType < playwright . ElementHandle < HTMLElement | SVGElement > , typeof handle > = true ;
718
- const canBeNull : AssertType < null , typeof handle > = true ;
729
+ const canBeNull : AssertCanBeNull < typeof handle > = true ;
719
730
}
720
731
}
721
732
0 commit comments