@@ -1213,11 +1213,24 @@ ${indentString(incr, 1)}
12131213 'checkResult' : true ,
12141214 } ;
12151215}
1216+
12161217// Possible inputs:
12171218//
12181219// * ("CSS selector", JSON dict)
12191220// * ("XPath", JSON dict)
12201221function parseWaitForSize ( parser ) {
1222+ return parseWaitForSizeInner ( parser , false ) ;
1223+ }
1224+
1225+ // Possible inputs:
1226+ //
1227+ // * ("CSS selector", JSON dict)
1228+ // * ("XPath", JSON dict)
1229+ function parseWaitForSizeFalse ( parser ) {
1230+ return parseWaitForSizeInner ( parser , true ) ;
1231+ }
1232+
1233+ function parseWaitForSizeInner ( parser , waitFalse ) {
12211234 const identifiers = [ 'ALL' ] ;
12221235 const ret = validator ( parser , {
12231236 kind : 'tuple' ,
@@ -1278,17 +1291,24 @@ function parseWaitForSize(parser) {
12781291 const whole = commonSizeCheckCode (
12791292 selector , enabledChecks . has ( 'ALL' ) , false , json , varName , errorsVarName ) ;
12801293
1294+ let comp = '===' ;
1295+ let errorMessage = '"The following checks still fail: [" + err + "]"' ;
1296+ if ( waitFalse ) {
1297+ comp = '!==' ;
1298+ errorMessage = '"All checks still pass"' ;
1299+ }
1300+
12811301 const [ init , looper ] = waitForElement ( selector , varName , { checkAll : enabledChecks . has ( 'ALL' ) } ) ;
12821302 const incr = incrWait ( `\
12831303const err = ${ errorsVarName } .join(", ");
1284- throw new Error("The following checks still fail: [" + err + "]" );` ) ;
1304+ throw new Error(${ errorMessage } );` ) ;
12851305
12861306 const instructions = `\
12871307${ init }
12881308while (true) {
12891309${ indentString ( looper , 1 ) }
12901310${ indentString ( whole , 1 ) }
1291- if (errors.length === 0) {
1311+ if (errors.length ${ comp } 0) {
12921312 break;
12931313 }
12941314
@@ -1325,4 +1345,5 @@ module.exports = {
13251345 'parseWaitForWindowProperty' : parseWaitForWindowProperty ,
13261346 'parseWaitForWindowPropertyFalse' : parseWaitForWindowPropertyFalse ,
13271347 'parseWaitForSize' : parseWaitForSize ,
1348+ 'parseWaitForSizeFalse' : parseWaitForSizeFalse ,
13281349} ;
0 commit comments