17
17
use Codeception \Exception \ModuleException ;
18
18
use Codeception \Util \Uri ;
19
19
use Codeception \Util \ActionSequence ;
20
+ use Magento \Setup \Exception ;
20
21
use Yandex \Allure \Adapter \Support \AttachmentSupport ;
21
22
22
23
/**
@@ -270,9 +271,16 @@ public function searchAndMultiSelectOption($select, array $options, $requireActi
270
271
*
271
272
* @param int $timeout
272
273
*/
273
- public function waitForAjaxLoad ($ timeout = 15 )
274
+ public function waitForAjaxLoad ($ timeout = null )
274
275
{
275
- $ this ->waitForJS ('return !!window.jQuery && window.jQuery.active == 0; ' , $ timeout );
276
+ $ timeout = $ timeout ?? $ this ->_getConfig ()['pageload_timeout ' ];
277
+
278
+ try {
279
+ $ this ->waitForJS ('return !!window.jQuery && window.jQuery.active == 0; ' , $ timeout );
280
+ } catch (\Exception $ exceptione ) {
281
+ $ this ->debug ("js never executed, performing {$ timeout } second wait. " );
282
+ $ this ->wait ($ timeout );
283
+ }
276
284
$ this ->wait (1 );
277
285
}
278
286
@@ -281,8 +289,10 @@ public function waitForAjaxLoad($timeout = 15)
281
289
*
282
290
* @param int $timeout
283
291
*/
284
- public function waitForPageLoad ($ timeout = 15 )
292
+ public function waitForPageLoad ($ timeout = null )
285
293
{
294
+ $ timeout = $ timeout ?? $ this ->_getConfig ()['pageload_timeout ' ];
295
+
286
296
$ this ->waitForJS ('return document.readyState == "complete" ' , $ timeout );
287
297
$ this ->waitForAjaxLoad ($ timeout );
288
298
$ this ->waitForLoadingMaskToDisappear ();
@@ -350,7 +360,7 @@ public function parseFloat($floatString){
350
360
/**
351
361
* @param int $category
352
362
* @param string $locale
353
- */
363
+ */
354
364
public function mSetLocale (int $ category , $ locale )
355
365
{
356
366
if (self ::$ localeAll [$ category ] == $ locale ) {
0 commit comments