Skip to content

Commit 1f5fa0c

Browse files
committed
MC-17014: Cannot Save FPT (Fixed Product Tax) On Catalog Product For Specific Website
- Update automated test script.
1 parent 62ffdd3 commit 1f5fa0c

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddWebsiteToProductActionGroup.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,4 @@
2020
<waitForPageLoad stepKey="waitForSimpleProductSaved"/>
2121
<see selector="{{AdminProductFormSection.successMessage}}" userInput="You saved the product." stepKey="seeAssertProductSaveSuccessMessage"/>
2222
</actionGroup>
23-
<actionGroup name="attachOneWebsiteToProductActionGroup" extends="AddWebsiteToProductActionGroup">
24-
<uncheckOption selector="{{ProductInWebsitesSection.website(_defaultWebsite.name)}}" stepKey="uncheckMainWebsiteInProduct2" before="checkWebsite"/>
25-
</actionGroup>
26-
</actionGroups>
23+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@
320320
<waitForPageLoad stepKey="waitForPageOpened"/>
321321
<checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/>
322322
</actionGroup>
323+
<actionGroup name="unassignWebsiteFromProductActionGroup" extends="SelectProductInWebsitesActionGroup">
324+
<remove keyForRemoval="selectWebsite"/>
325+
<uncheckOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="unSelectWebsite" after="waitForPageOpened"/>
326+
</actionGroup>
323327

324328
<actionGroup name="AdminProductAddSpecialPrice">
325329
<arguments>

app/code/Magento/Tax/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,18 @@
4747
<argument name="StoreGroup" value="NewStoreData"/>
4848
<argument name="customStore" value="storeViewData"/>
4949
</actionGroup>
50+
<!--Set catalog price scope to Global-->
51+
<comment userInput="Set catalog price scope to Global" stepKey="commentSetPriceScope"/>
5052
<magentoCLI command="config:set catalog/price/scope 0" stepKey="setPriceScopeGlobal"/>
5153
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
5254
<magentoCLI command="cache:flush" stepKey="flushCache"/>
5355
</before>
5456
<after>
57+
<!--Set catalog price scope to Global-->
58+
<comment userInput="Set catalog price scope to Global" stepKey="commentSetPriceScope"/>
59+
<magentoCLI command="config:set catalog/price/scope 0" stepKey="setPriceScopeGlobal"/>
60+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
61+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
5562
<!-- Delete created data and log out -->
5663
<comment userInput="Delete created data and log out" stepKey="deleteDataAndLogOut"/>
5764
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
@@ -65,25 +72,46 @@
6572
<!-- Go to product edit page and assign it to created website -->
6673
<comment userInput="Go to product edit page and assign it to created website" stepKey="assignProductToCreatedWebsite"/>
6774
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="navigateToProductPage"/>
68-
<actionGroup ref="attachOneWebsiteToProductActionGroup" stepKey="updateSimpleProductAddingWebsiteCreated">
75+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
76+
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectWebsiteInProduct">
6977
<argument name="website" value="{{NewWebSiteData.name}}"/>
7078
</actionGroup>
79+
<actionGroup ref="saveProductForm" stepKey="saveProductFirstTime"/>
7180
<!-- Add Fixed Product Tax attribute -->
7281
<comment userInput="Add Fixed Product Tax attribute" stepKey="addFixedProdTaxAttr"/>
7382
<actionGroup ref="AdminProductAddFPTValueActionGroup" stepKey="addFixedProductTaxAttr">
7483
<argument name="FPTAttributeCode" value="$$createProductFPTAttribute.attribute_code$$"/>
7584
<argument name="stateForFPT" value="California"/>
7685
<argument name="valueForFPT" value="10"/>
7786
</actionGroup>
78-
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
87+
<actionGroup ref="saveProductForm" stepKey="saveProductSecondTime"/>
7988
<!-- Check if created tax attribute is saved -->
8089
<comment userInput="Check if created tax attribute is saved" stepKey="checkThatTaxAttributeIsSaved"/>
8190
<seeElement selector="{{AdminProductAddFPTValueSection.setTaxValueForFPT($$createProductFPTAttribute.attribute_code$$)}}" stepKey="checkIfTaxAttributeSaved"/>
82-
<selectOption selector="{{AdminProductAddFPTValueSection.setWebSiteForFPT($$createProductFPTAttribute.attribute_code$$)}}" userInput="All Websites USD" stepKey="selectAllWebsites"/>
83-
<grabTextFrom selector="{{AdminProductAddFPTValueSection.setWebSiteForFPT($$createProductFPTAttribute.attribute_code$$)}}" stepKey="grabAllWebsites"/>
84-
<assertContains expectedType="string" expected="All Websites USD" actualType="variable" actual="$grabAllWebsites" stepKey="assertContainsAllWebsites"/>
85-
<selectOption selector="{{AdminProductAddFPTValueSection.setWebSiteForFPT($$createProductFPTAttribute.attribute_code$$)}}" userInput="{{NewWebSiteData.name}} USD" stepKey="selectSecondWebsite"/>
86-
<grabTextFrom selector="{{AdminProductAddFPTValueSection.setWebSiteForFPT($$createProductFPTAttribute.attribute_code$$)}}" stepKey="grabSecondWebsite"/>
87-
<assertContains expectedType="string" expected="{{NewWebSiteData.name}}" actualType="variable" actual="$grabSecondWebsite" stepKey="assertContainsSecondWebsite"/>
91+
<!--See available websites only 'All Websites'-->
92+
<comment userInput="See available websites only 'All Websites'" stepKey="commentCheckWebsitesDropDown"/>
93+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'All Websites')}}" stepKey="seeAllWebsites"/>
94+
<dontSeeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, NewWebSiteData.name)}}" stepKey="dontSeeSecondWebsite"/>
95+
<dontSeeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'Main Website')}}" stepKey="dontSeeMainWebsite"/>
96+
<!--Set catalog price scope to Website-->
97+
<comment userInput="Set catalog price scope to Website" stepKey="commentSetPriceScope"/>
98+
<magentoCLI command="config:set catalog/price/scope 1" stepKey="setPriceScopeWebsite"/>
99+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
100+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
101+
<!--See available websites only 'All Websites'-->
102+
<comment userInput="See available websites 'All Websites', 'Main Website' and Second website" stepKey="commentCheckWebsitesInProductPage"/>
103+
<amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProductPageSecondTime"/>
104+
<waitForPageLoad stepKey="waitForProductPageLoadSecondTime"/>
105+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'All Websites')}}" stepKey="checkAllWebsitesInDropDown"/>
106+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'Main Website')}}" stepKey="checkMainWebsiteInDropDown"/>
107+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, NewWebSiteData.name)}}" stepKey="checkSecondWebsitesInDropDown"/>
108+
<actionGroup ref="unassignWebsiteFromProductActionGroup" stepKey="unassignWebsiteInProduct">
109+
<argument name="website" value="{{_defaultWebsite.name}}"/>
110+
</actionGroup>
111+
<actionGroup ref="saveProductForm" stepKey="saveProductThirdTime"/>
112+
<waitForPageLoad stepKey="waitForSavedProductLoad"/>
113+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'All Websites')}}" stepKey="checkAllWebsitesInDropDownSecondTime"/>
114+
<dontSeeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, 'Main Website')}}" stepKey="checkNoMainWebsiteInDropDown"/>
115+
<seeElement selector="{{AdminProductAddFPTValueSection.setWebSiteForFPTOption($$createProductFPTAttribute.attribute_code$$, NewWebSiteData.name)}}" stepKey="checkSecondWebsitesInDropDownSecondTime"/>
88116
</test>
89117
</tests>

app/code/Magento/Weee/Test/Mftf/Section/AdminProductAddFPTValueSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<element name="selectStateForFPT" type="select" selector="(//select[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[state]')])[last()]" parameterized="true"/>
1616
<element name="setTaxValueForFPT" type="text" selector="(//input[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[value]')])[last()]" parameterized="true"/>
1717
<element name="setWebSiteForFPT" type="text" selector="(//select[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[website_id]')])[last()]" parameterized="true"/>
18+
<element name="setWebSiteForFPTOption" type="text" selector="(//select[contains(@name, 'product[{{FPTAttributeCode}}]') and contains(@name, '[website_id]')])/option[contains(text(), '{{website}}')]" parameterized="true"/>
1819
</section>
1920
</sections>

0 commit comments

Comments
 (0)