Skip to content

Commit

Permalink
Merge pull request #84 from magento-pangolin/MC-4428
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyau authored Apr 5, 2019
2 parents 3777ff7 + e318e6f commit 2fe3f1c
Show file tree
Hide file tree
Showing 11 changed files with 272 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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="AdminCreateNewCatalogPriceRuleActionGroup">
<arguments>
<argument name="catalogRule" defaultValue="_defaultCatalogRule"/>
<argument name="customerGroup" type="string"/>
</arguments>
<amOnPage url="{{AdminNewCatalogPriceRulePage.url}}" stepKey="openNewCatalogPriceRulePage"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
<fillField stepKey="fillName" selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{catalogRule.name}}"/>
<fillField stepKey="fillDescription" selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{catalogRule.description}}"/>
<selectOption selector="{{AdminNewCatalogPriceRule.status}}" userInput="{{catalogRule.is_active}}" stepKey="selectStatus"/>
<selectOption stepKey="selectWebSite" selector="{{AdminNewCatalogPriceRule.websites}}" userInput="{{catalogRule.website_ids[0]}}"/>
<selectOption selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroup}}" stepKey="selectCustomerGroup"/>
<scrollTo selector="{{AdminNewCatalogPriceRule.actionsTab}}" stepKey="scrollToActionTab"/>
<click stepKey="openActionDropdown" selector="{{AdminNewCatalogPriceRule.actionsTab}}"/>
<selectOption stepKey="discountType" selector="{{AdminNewCatalogPriceRuleActions.apply}}" userInput="{{catalogRule.simple_action}}"/>
<fillField stepKey="fillDiscountValue" selector="{{AdminNewCatalogPriceRuleActions.discountAmount}}" userInput="{{catalogRule.discount_amount}}"/>
<selectOption stepKey="discardSubsequentRules" selector="{{AdminNewCatalogPriceRuleActions.disregardRules}}" userInput="Yes"/>
<waitForPageLoad stepKey="waitForApplied"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AdminDeleteCatalogRuleActionGroup">
<click selector="{{AdminNewCatalogPriceRule.delete}}" stepKey="clickOnDeleteButton"/>
<waitForElementVisible selector="{{AdminNewCatalogPriceRule.okButton}}" stepKey="waitForOkButtonToBeVisible"/>
<click selector="{{AdminNewCatalogPriceRule.okButton}}" stepKey="clickOnOkButton"/>
<waitForPageLoad stepKey="waitForPagetoLoad"/>
<see selector="{{AdminNewCatalogPriceRule.successMessage}}" userInput="You deleted the rule." stepKey="seeSuccessDeleteMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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="AdminSaveAndApplyRulesActionGroup">
<waitForPageLoad stepKey="waitForPageToLoad"/>
<scrollToTopOfPage stepKey="scrollToTop"/>
<click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="saveTheCatalogRule"/>
<waitForPageLoad stepKey="waitForPageToLoad1"/>
<seeElement selector="{{AdminCatalogPriceRuleGrid.updateMessage}}" stepKey="seeMessageToUpdateTheCatalogRules"/>
<see selector="{{AdminNewCatalogPriceRule.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
<click stepKey="applyRules" selector="{{AdminCatalogPriceRuleGrid.applyRules}}"/>
<see stepKey="assertSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="Updated rules applied."/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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="AdminSearchCatalogRuleInGridActionGroup">
<arguments>
<argument name="catalogRuleName" type="string"/>
</arguments>
<amOnPage stepKey="goToPriceRulePage" url="{{CatalogRulePage.url}}"/>
<waitForPageLoad stepKey="waitForPriceRulePage"/>
<click selector="{{AdminCatalogPriceRuleGrid.resetFilter}}" stepKey="clickOnResetFilter"/>
<waitForPageLoad stepKey="waitForTheGridPageToLoad"/>
<fillField selector="{{AdminCatalogPriceRuleGrid.ruleFilter}}" userInput="{{catalogRuleName}}" stepKey="fillTheRuleFilter"/>
<click selector="{{AdminCatalogPriceRuleGrid.search}}" stepKey="clickOnSearchButton"/>
<waitForPageLoad stepKey="waitForTheSearchResult"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AdminSelectCatalogRuleFromGridActionGroup">
<arguments>
<argument name="catalogRuleName" type="string"/>
</arguments>
<click selector="{{AdminCatalogPriceRuleGrid.selectRowByRuleName(catalogRuleName)}}" stepKey="selectRow"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
</actionGroup>
</actionGroups>
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="AssertCatalogPriceRuleFormActionGroup">
<arguments>
<argument name="catalogRule" defaultValue="inactiveCatalogRule" />
<argument name="status" type="string" defaultValue=""/>
<argument name="websites" type="string"/>
<argument name="customerGroup" type="string"/>
</arguments>
<seeInField stepKey="fillName" selector="{{AdminNewCatalogPriceRule.ruleName}}" userInput="{{catalogRule.name}}"/>
<seeInField stepKey="fillDescription" selector="{{AdminNewCatalogPriceRule.description}}" userInput="{{catalogRule.description}}"/>
<seeOptionIsSelected selector="{{AdminNewCatalogPriceRule.status}}" userInput="{{status}}" stepKey="selectStatus"/>
<see stepKey="seeWebSite" selector="{{AdminNewCatalogPriceRule.websites}}" userInput="{{websites}}"/>
<seeOptionIsSelected selector="{{AdminNewCatalogPriceRule.customerGroups}}" userInput="{{customerGroup}}" stepKey="selectCustomerGroup"/>
<scrollTo selector="{{AdminNewCatalogPriceRule.actionsTab}}" stepKey="scrollToActionTab"/>
<click stepKey="openActionDropdown" selector="{{AdminNewCatalogPriceRule.actionsTab}}"/>
<seeInField stepKey="discountType" selector="{{AdminNewCatalogPriceRuleActions.apply}}" userInput="{{catalogRule.simple_action}}"/>
<seeInField stepKey="fillDiscountValue" selector="{{AdminNewCatalogPriceRuleActions.discountAmount}}" userInput="{{catalogRule.discount_amount}}"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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="AssertCatalogRuleInGridActionGroup">
<arguments>
<argument name="catalogRuleName" type="string"/>
<argument name="status" type="string" defaultValue=""/>
<argument name="websites" type="string"/>
<argument name="catalogRuleId" type="string"/>
</arguments>
<see selector="{{AdminCatalogPriceRuleGrid.firstRow}}" userInput="{{catalogRuleId}}" stepKey="seeCatalogRuleId"/>
<see selector="{{AdminCatalogPriceRuleGrid.firstRow}}" userInput="{{catalogRuleName}}" stepKey="seeCatalogRuleName"/>
<see selector="{{AdminCatalogPriceRuleGrid.firstRow}}" userInput="{{status}}" stepKey="seeCatalogRuleStatus"/>
<see selector="{{AdminCatalogPriceRuleGrid.firstRow}}" userInput="{{websites}}" stepKey="seeCatalogRuleWebsite"/>
</actionGroup>
</actionGroups>
13 changes: 13 additions & 0 deletions app/code/Magento/CatalogRule/Test/Mftf/Data/CatalogRuleData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@
<data key="simple_action">by_percent</data>
<data key="discount_amount">10</data>
</entity>
<entity name="InactiveCatalogRule" type="catalogRule">
<data key="name" unique="suffix">InactiveCatalogRule</data>
<data key="description">Inactive Catalog Price Rule Description</data>
<data key="is_active">0</data>
<array key="customer_group_ids">
<item>1</item>
</array>
<array key="website_ids">
<item>1</item>
</array>
<data key="simple_action">by_fixed</data>
<data key="discount_amount">10</data>
</entity>

<entity name="CatalogRuleWithoutDiscount" type="catalogRule">
<data key="name" unique="suffix">CatalogPriceRuleWithoutDiscount</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminNewCatalogPriceRulePage" url="catalog_rule/promo_catalog/new/" module="Magento_CatalogRule" area="admin">
<section name="AdminNewCatalogPriceRule"/>
</page>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<element name="save" type="button" selector="#save" timeout="30"/>
<element name="saveAndContinue" type="button" selector="#save_and_continue" timeout="30"/>
<element name="delete" type="button" selector="#delete" timeout="30"/>
<element name="okButton" type="button" selector="//button[@class='action-primary action-accept']"/>
<element name="successMessage" type="text" selector="#messages"/>

<element name="ruleName" type="input" selector="[name='name']"/>
<element name="description" type="textarea" selector="[name='description']"/>
Expand Down Expand Up @@ -51,5 +53,11 @@

<section name="AdminCatalogPriceRuleGrid">
<element name="applyRules" type="button" selector="#apply_rules" timeout="30"/>
<element name="updateMessage" type="text" selector="//div[@class='message message-notice notice']//div[contains(.,'We found updated rules that are not applied. Please click')]"/>
<element name="ruleFilter" type="input" selector="//td[@data-column='name']/input[@name='name']"/>
<element name="resetFilter" type="button" selector="//button[@title='Reset Filter']" timeout="30"/>
<element name="search" type="button" selector="//div[@id='promo_catalog_grid']//button[@title='Search']" timeout="30"/>
<element name="selectRowByRuleName" type="text" selector="//tr[@data-role='row']//td[contains(.,'{{ruleName}}')]" parameterized="true"/>
<element name="firstRow" type="text" selector="//tr[@data-role='row']"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCreateInactiveCatalogPriceRuleTest">
<annotations>
<stories value="Create Catalog Price Rule"/>
<title value="Create Inactive Catalog Price Rule"/>
<description value="Login as admin and create inactive catalog price Rule"/>
<testCaseId value="MC-13977"/>
<severity value="CRITICAL"/>
<group value="mtf_migrated"/>
</annotations>

<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
</before>
<after>
<actionGroup ref="AdminSearchCatalogRuleInGridActionGroup" stepKey="searchCreatedCatalogRule">
<argument name="catalogRuleName" value="{{InactiveCatalogRule.name}}"/>
</actionGroup>
<actionGroup ref="AdminSelectCatalogRuleFromGridActionGroup" stepKey="selectCreatedCatalogRule">
<argument name="catalogRuleName" value="{{InactiveCatalogRule.name}}"/>
</actionGroup>
<actionGroup ref="AdminDeleteCatalogRuleActionGroup" stepKey="deleteTheCatalogRule"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!-- Create Inactive Catalog Price Rule -->
<actionGroup ref="AdminCreateNewCatalogPriceRuleActionGroup" stepKey="createCatalogPriceRule">
<argument name="catalogRule" value="InactiveCatalogRule"/>
<argument name="customerGroup" value="General"/>
</actionGroup>

<!-- Save and Apply Rules -->
<actionGroup ref="AdminSaveAndApplyRulesActionGroup" stepKey="saveAndApplyRules"/>

<!-- Search Catalog Rule in Grid -->
<actionGroup ref="AdminSearchCatalogRuleInGridActionGroup" stepKey="searchAndSelectCreatedCatalogRule">
<argument name="catalogRuleName" value="{{InactiveCatalogRule.name}}"/>
</actionGroup>

<!--Select Catalog Rule in Grid -->
<actionGroup ref="AdminSelectCatalogRuleFromGridActionGroup" stepKey="selectCreatedCatalogRule">
<argument name="catalogRuleName" value="{{InactiveCatalogRule.name}}"/>
</actionGroup>
<grabFromCurrentUrl stepKey="catalogRuleId" regex="#\/([0-9]*)?\/$#"/>

<!-- Assert catalog Price Rule Form -->
<actionGroup ref="AssertCatalogPriceRuleFormActionGroup" stepKey="assertCatalogRuleForm">
<argument name="catalogRule" value="InactiveCatalogRule"/>
<argument name="status" value="Inactive"/>
<argument name="websites" value="Main Website"/>
<argument name="customerGroup" value="General"/>
</actionGroup>

<!-- Search Catalog Rule in Grid -->
<actionGroup ref="AdminSearchCatalogRuleInGridActionGroup" stepKey="searchCreatedCatalogRule">
<argument name="catalogRuleName" value="{{InactiveCatalogRule.name}}"/>
</actionGroup>

<!-- Assert Catalog Rule In Grid -->
<actionGroup ref="AssertCatalogRuleInGridActionGroup" stepKey="assertCatalogRuleInGrid">
<argument name="catalogRuleName" value="{{InactiveCatalogRule.name}}"/>
<argument name="status" value="Inactive"/>
<argument name="websites" value="Main Website"/>
<argument name="catalogRuleId" value="$catalogRuleId"/>
</actionGroup>
</test>
</tests>

0 comments on commit 2fe3f1c

Please sign in to comment.