@@ -193,15 +193,14 @@ describe('Puppeteer', function () {
193
193
} ) ;
194
194
195
195
describe ( '#waitNumberOfVisibleElements' , ( ) => {
196
- it ( 'should wait for a specified number of elements on the page' , ( ) => I . amOnPage ( '/info' )
197
- . then ( ( ) => I . waitNumberOfVisibleElements ( '//div[@id = "grab-multiple"]//a' , 3 ) )
198
- . then ( ( ) => I . waitNumberOfVisibleElements ( '//div[@id = "grab-multiple"]//a' , 2 , 0.1 ) )
199
- . then ( ( ) => {
200
- throw Error ( 'It should never get this far' ) ;
201
- } )
202
- . catch ( ( e ) => {
196
+ it ( 'should wait for a specified number of elements on the page' , async ( ) => {
197
+ try {
198
+ await I . amOnPage ( '/info' ) ;
199
+ await I . waitNumberOfVisibleElements ( '//div[@id = "grab-multiple"]//a' , 3 ) ;
200
+ } catch ( e ) {
203
201
e . message . should . include ( 'The number of elements (//div[@id = "grab-multiple"]//a) is not 2 after 0.1 sec' ) ;
204
- } ) ) ;
202
+ }
203
+ } ) ;
205
204
206
205
it ( 'should wait for a specified number of elements on the page using a css selector' , ( ) => I . amOnPage ( '/info' )
207
206
. then ( ( ) => I . waitNumberOfVisibleElements ( '#grab-multiple > a' , 3 ) )
@@ -217,6 +216,11 @@ describe('Puppeteer', function () {
217
216
. then ( ( ) => I . waitNumberOfVisibleElements ( '.title' , 2 , 3 ) )
218
217
. then ( ( ) => I . see ( 'Hello' ) )
219
218
. then ( ( ) => I . see ( 'World' ) ) ) ;
219
+
220
+ it ( 'should wait for 0 number of visible elements' , async ( ) => {
221
+ await I . amOnPage ( '/form/wait_invisible' ) ;
222
+ await I . waitNumberOfVisibleElements ( '#step_1' , 0 ) ;
223
+ } ) ;
220
224
} ) ;
221
225
222
226
describe ( '#moveCursorTo' , ( ) => {
0 commit comments