Skip to content

Commit 33a862f

Browse files
authored
MQE-462: Update waitForLoadingMaskToDisappear to handle duplicated masks
- Changed loadingMasks to an array - Changed waitForLoadingMaskToDisappear to recurse through all loading mask elements if multiple are found.
1 parent 6a17e5e commit 33a862f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@
4141
class MagentoWebDriver extends WebDriver
4242
{
4343
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+
];
4551

4652
/**
4753
* The module required fields, to be set in the suite .yml configuration file.
@@ -189,17 +195,20 @@ public function waitForPageLoad($timeout = 15)
189195
{
190196
$this->waitForJS('return document.readyState == "complete"', $timeout);
191197
$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();
195199
}
196200

197201
/**
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.
199203
*/
200204
public function waitForLoadingMaskToDisappear()
201205
{
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+
}
203212
}
204213

205214
/**

0 commit comments

Comments
 (0)