|
41 | 41 | class MagentoWebDriver extends WebDriver |
42 | 42 | { |
43 | 43 | use AttachmentSupport; |
44 | | - public static $loadingMask = '.loading-mask'; |
| 44 | + public static $loadingMasksLocators = [ |
| 45 | + '//div[contains(@class, "loading-mask")]', |
| 46 | + '//div[contains(@class, "admin_data-grid-loading-mask")]', |
| 47 | + '//div[contains(@class, "admin__data-grid-loading-mask")]', |
| 48 | + '//div[contains(@class, "admin__form-loading-mask")]', |
| 49 | + '//div[@data-role="spinner"]' |
| 50 | + ]; |
45 | 51 |
|
46 | 52 | /** |
47 | 53 | * The module required fields, to be set in the suite .yml configuration file. |
@@ -189,17 +195,20 @@ public function waitForPageLoad($timeout = 15) |
189 | 195 | { |
190 | 196 | $this->waitForJS('return document.readyState == "complete"', $timeout); |
191 | 197 | $this->waitForAjaxLoad($timeout); |
192 | | - $this->waitForElementNotVisible('.loading-mask', 30); |
193 | | - $this->waitForElementNotVisible('.admin_data-grid-loading-mask', 30); |
194 | | - $this->waitForElementNotVisible('.admin__form-loading-mask', 30); |
| 198 | + $this->waitForLoadingMaskToDisappear(); |
195 | 199 | } |
196 | 200 |
|
197 | 201 | /** |
198 | | - * Wait for the Loading mask to disappear. |
| 202 | + * Wait for all visible loading masks to disappear. Gets all elements by mask selector, then loops over them. |
199 | 203 | */ |
200 | 204 | public function waitForLoadingMaskToDisappear() |
201 | 205 | { |
202 | | - $this->waitForElementNotVisible(self::$loadingMask, 30); |
| 206 | + foreach( self::$loadingMasksLocators as $maskLocator) { |
| 207 | + $loadingMaskElements = $this->_findElements($maskLocator); |
| 208 | + for ($i = 1; $i <= count($loadingMaskElements); $i++) { |
| 209 | + $this->waitForElementNotVisible("{$maskLocator}[{$i}]", 30); |
| 210 | + } |
| 211 | + } |
203 | 212 | } |
204 | 213 |
|
205 | 214 | /** |
|
0 commit comments