1717use Codeception \Exception \ModuleException ;
1818use Codeception \Util \Uri ;
1919use Codeception \Util \ActionSequence ;
20+ use Magento \Setup \Exception ;
2021use Yandex \Allure \Adapter \Support \AttachmentSupport ;
2122
2223/**
@@ -270,9 +271,16 @@ public function searchAndMultiSelectOption($select, array $options, $requireActi
270271 *
271272 * @param int $timeout
272273 */
273- public function waitForAjaxLoad ($ timeout = 15 )
274+ public function waitForAjaxLoad ($ timeout = null )
274275 {
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+ }
276284 $ this ->wait (1 );
277285 }
278286
@@ -281,8 +289,10 @@ public function waitForAjaxLoad($timeout = 15)
281289 *
282290 * @param int $timeout
283291 */
284- public function waitForPageLoad ($ timeout = 15 )
292+ public function waitForPageLoad ($ timeout = null )
285293 {
294+ $ timeout = $ timeout ?? $ this ->_getConfig ()['pageload_timeout ' ];
295+
286296 $ this ->waitForJS ('return document.readyState == "complete" ' , $ timeout );
287297 $ this ->waitForAjaxLoad ($ timeout );
288298 $ this ->waitForLoadingMaskToDisappear ();
@@ -350,7 +360,7 @@ public function parseFloat($floatString){
350360 /**
351361 * @param int $category
352362 * @param string $locale
353- */
363+ */
354364 public function mSetLocale (int $ category , $ locale )
355365 {
356366 if (self ::$ localeAll [$ category ] == $ locale ) {
0 commit comments