-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5811 from magento-tsg/2.4-develop-pr51
[TSG] TESTs Fixes for 2.4.1 (pr51) (2.4-develop)
- Loading branch information
Showing
6 changed files
with
120 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Rule\Test\Mftf\Helper; | ||
|
||
use Facebook\WebDriver\Remote\RemoteWebDriver as FacebookWebDriver; | ||
use Facebook\WebDriver\WebDriverBy; | ||
use Magento\FunctionalTestingFramework\Helper\Helper; | ||
use Magento\FunctionalTestingFramework\Module\MagentoWebDriver; | ||
|
||
/** | ||
* Class for MFTF helpers for CatalogRule module. | ||
*/ | ||
class RuleHelper extends Helper | ||
{ | ||
/** | ||
* Delete all Catalog Price Rules obe by one. | ||
* | ||
* @param string $emptyRow | ||
* @param string $modalAceptButton | ||
* @param string $deleteButton | ||
* @param string $successMessageContainer | ||
* @param string $successMessage | ||
* | ||
* @return void | ||
*/ | ||
public function deleteAllRulesOneByOne( | ||
string $firstNotEmptyRow, | ||
string $modalAcceptButton, | ||
string $deleteButton, | ||
string $successMessageContainer, | ||
string $successMessage | ||
): void { | ||
try { | ||
/** @var MagentoWebDriver $webDriver */ | ||
$magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver'); | ||
/** @var FacebookWebDriver $webDriver */ | ||
$webDriver = $magentoWebDriver->webDriver; | ||
$rows = $webDriver->findElements(WebDriverBy::cssSelector($firstNotEmptyRow)); | ||
while (!empty($rows)) { | ||
$rows[0]->click(); | ||
$magentoWebDriver->waitForPageLoad(30); | ||
$magentoWebDriver->click($deleteButton); | ||
$magentoWebDriver->waitForPageLoad(30); | ||
$magentoWebDriver->waitForElementVisible($modalAcceptButton, 10); | ||
$magentoWebDriver->waitForPageLoad(60); | ||
$magentoWebDriver->click($modalAcceptButton); | ||
$magentoWebDriver->waitForPageLoad(60); | ||
$magentoWebDriver->waitForLoadingMaskToDisappear(); | ||
$magentoWebDriver->waitForElementVisible($successMessageContainer, 10); | ||
$magentoWebDriver->see($successMessage, $successMessageContainer); | ||
$rows = $webDriver->findElements(WebDriverBy::cssSelector($firstNotEmptyRow)); | ||
} | ||
} catch (\Exception $e) { | ||
$this->fail($e->getMessage()); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCartPriceRuleDeleteAllActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AdminCartPriceRuleDeleteAllActionGroup"> | ||
<annotations> | ||
<description>Open Cart Price Rule grid and delete all rules one by one. Need to avoid interference with other tests that test cart price rules.</description> | ||
</annotations> | ||
|
||
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="goToAdminCartPriceRuleGridPage"/> | ||
<!-- It sometimes is loading too long for default 10s --> | ||
<waitForPageLoad time="60" stepKey="waitForPageFullyLoaded"/> | ||
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/> | ||
<helper class="\Magento\Rule\Test\Mftf\Helper\RuleHelper" method="deleteAllRulesOneByOne" stepKey="deleteAllRulesOneByOne"> | ||
<argument name="firstNotEmptyRow">{{AdminDataGridTableSection.firstNotEmptyRow}}</argument> | ||
<argument name="modalAcceptButton">{{AdminConfirmationModalSection.ok}}</argument> | ||
<argument name="deleteButton">{{AdminMainActionsSection.delete}}</argument> | ||
<argument name="successMessageContainer">{{AdminMessagesSection.success}}</argument> | ||
<argument name="successMessage">You deleted the rule.</argument> | ||
</helper> | ||
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/> | ||
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/> | ||
</actionGroup> | ||
</actionGroups> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters