3636 async function ( alias : string , waitType : string , value : string , timeout : number | null ) {
3737 const wait = getPollValidation ( waitType ) ;
3838 const element = await getElement ( alias ) ;
39+ await element . waitFor ( { state : 'attached' } ) ;
3940 const expectedValue = await getValue ( value ) ;
40- const getValueFn = async ( ) => element . innerText ( ) ;
41+ const getValueFn = ( ) => element . innerText ( ) ;
4142 await wait ( getValueFn , expectedValue , {
4243 timeout : timeout ?? config . browser . timeout . value ,
4344 interval : config . browser . timeout . valueInterval
6263 const wait = getPollValidation ( waitType ) ;
6364 const collection = await getElement ( alias ) ;
6465 const expectedValue = await getValue ( value ) ;
65- const getValueFn = async ( ) => collection . count ( ) ;
66+ const getValueFn = ( ) => collection . count ( ) ;
6667 await wait ( getValueFn , expectedValue , {
6768 timeout : timeout ?? config . browser . timeout . value ,
6869 interval : config . browser . timeout . valueInterval
8687 const propertyName = await getValue ( property ) ;
8788 const wait = getPollValidation ( waitType ) ;
8889 const element = await getElement ( alias ) ;
90+ await element . waitFor ( { state : 'attached' } ) ;
8991 const expectedValue = await getValue ( value ) ;
90- const getValueFn = async ( ) => element . evaluate (
92+ const getValueFn = ( ) => element . evaluate (
9193 ( node : any , propertyName : string ) => node [ propertyName ] ,
9294 propertyName
9395 ) ;
@@ -114,8 +116,9 @@ When(
114116 const propertyName = await getValue ( property ) ;
115117 const wait = getPollValidation ( waitType ) ;
116118 const element = await getElement ( alias ) ;
119+ await element . waitFor ( { state : 'attached' } ) ;
117120 const expectedValue = await getValue ( value ) ;
118- const getValueFn = async ( ) => element . evaluate (
121+ const getValueFn = ( ) => element . evaluate (
119122 ( node : Element , propertyName : string ) => getComputedStyle ( node ) . getPropertyValue ( propertyName ) ,
120123 propertyName
121124 ) ;
@@ -142,8 +145,9 @@ When(
142145 const attributeName = await getValue ( attribute ) ;
143146 const wait = getPollValidation ( waitType ) ;
144147 const element = await getElement ( alias ) ;
148+ await element . waitFor ( { state : 'attached' } ) ;
145149 const expectedValue = await getValue ( value ) ;
146- const getValueFn = async ( ) => element . getAttribute ( attributeName ) ;
150+ const getValueFn = ( ) => element . getAttribute ( attributeName ) ;
147151 await wait ( getValueFn , expectedValue , {
148152 timeout : timeout ?? config . browser . timeout . value ,
149153 interval : config . browser . timeout . valueInterval
@@ -176,7 +180,7 @@ When(
176180 async function ( waitType : string , value : string , timeout : number | null ) {
177181 const wait = getPollValidation ( waitType ) ;
178182 const expectedValue = await getValue ( value ) ;
179- const getValueFn = async ( ) => page . url ( ) ;
183+ const getValueFn = ( ) => page . url ( ) ;
180184 await wait ( getValueFn , expectedValue , {
181185 timeout : timeout ?? config . browser . timeout . value ,
182186 interval : config . browser . timeout . valueInterval
@@ -198,7 +202,7 @@ When(
198202 async function ( waitType : string , value : string , timeout : number | null ) {
199203 const wait = getPollValidation ( waitType ) ;
200204 const expectedValue = await getValue ( value ) ;
201- const getValueFn = async ( ) => page . title ( ) ;
205+ const getValueFn = ( ) => page . title ( ) ;
202206 await wait ( getValueFn , expectedValue , {
203207 timeout : timeout ?? config . browser . timeout . value ,
204208 interval : config . browser . timeout . valueInterval
0 commit comments