Skip to content

Commit 3a68504

Browse files
authored
Merge pull request #4787 from magento-tsg/2.2-develop-pr116
[TSG] Fixes for 2.2 (pr116) (2.2-develop)
2 parents 6a7484e + 96bd13c commit 3a68504

18 files changed

+923
-3
lines changed

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
11-
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1211
<!--Create a new category-->
1312
<actionGroup name="CreateCategory">
1413
<arguments>
@@ -122,4 +121,29 @@
122121
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveCategory"/>
123122
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="assertSuccess"/>
124123
</actionGroup>
124+
125+
<actionGroup name="DeleteDefaultCategoryChildren">
126+
<annotations>
127+
<description>Deletes all children categories of Default Root Category.</description>
128+
</annotations>
129+
130+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToAdminCategoryPage"/>
131+
<executeInSelenium function="function ($webdriver) use ($I) {
132+
$children = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(.,
133+
\'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a'));
134+
while (!empty($children)) {
135+
$I->click('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(.,
136+
\'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a');
137+
$I->waitForPageLoad(30);
138+
$I->click('#delete');
139+
$I->waitForElementVisible('aside.confirm .modal-footer button.action-accept');
140+
$I->click('aside.confirm .modal-footer button.action-accept');
141+
$I->waitForPageLoad(30);
142+
$I->waitForElementVisible('#messages div.message-success', 30);
143+
$I->see('You deleted the category.', '#messages div.message-success');
144+
$children = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//ul[contains(@class, \'x-tree-node-ct\')]/li[@class=\'x-tree-node\' and contains(.,
145+
\'{{DefaultCategory.name}}\')]/ul[contains(@class, \'x-tree-node-ct\')]/li//a'));
146+
}
147+
}" stepKey="deleteAllChildCategories"/>
148+
</actionGroup>
125149
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
1111
<entity name="_defaultCategory" type="category">
1212
<data key="name" unique="suffix">simpleCategory</data>
1313
<data key="name_lwr" unique="suffix">simplecategory</data>
@@ -47,4 +47,10 @@
4747
<data key="name" unique="suffix">Bags</data>
4848
<data key="url_key" unique="suffix">bags</data>
4949
</entity>
50+
<entity name="SubCategoryNonAnchor" extends="SubCategoryWithParent">
51+
<requiredEntity type="custom_attribute">CustomAttributeCategoryNonAnchor</requiredEntity>
52+
</entity>
53+
<entity name="DefaultCategory" type="category">
54+
<data key="name">Default Category</data>
55+
</entity>
5056
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/CustomAttributeData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,8 @@
3636
<data key="attribute_code">news_from_date</data>
3737
<data key="value">2018-05-17 00:00:00</data>
3838
</entity>
39+
<entity name="CustomAttributeCategoryNonAnchor" type="custom_attribute">
40+
<data key="attribute_code">is_anchor</data>
41+
<data key="value">0</data>
42+
</entity>
3943
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,4 +345,9 @@
345345
<data key="quantity">0</data>
346346
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
347347
</entity>
348+
<entity name="ProductFileOptionWithScriptTag" type="product">
349+
<var key="sku" entityType="product" entityKey="sku"/>
350+
<data key="file">&lt;img src=x onerror='alert("XSS without &lt;script&gt;&lt;:script&gt; tags...")'&gt;.png</data>
351+
<requiredEntity type="product_option">ProductOptionFile</requiredEntity>
352+
</entity>
348353
</entities>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml

Lines changed: 336 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontVerifyCannotLoadFileWithIncorrectNameThroughCustomOptionsTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Custom options"/>
15+
<title value="Verify cannot load file with incorrect name through Custom options"/>
16+
<description value="Verify cannot load file with incorrect name through Custom options"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-7811"/>
19+
<group value="catalog"/>
20+
</annotations>
21+
<before>
22+
<!-- Create customer -->
23+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
24+
<!-- Create category -->
25+
<createData entity="_defaultCategory" stepKey="createCategory"/>
26+
<!-- Create simple product -->
27+
<createData entity="_defaultProduct" stepKey="createProduct">
28+
<requiredEntity createDataKey="createCategory"/>
29+
</createData>
30+
<!-- Add file upload custom option to the product -->
31+
<updateData createDataKey="createProduct" entity="ProductFileOptionWithScriptTag" stepKey="updateProductWithOption"/>
32+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
33+
</before>
34+
<after>
35+
<!-- Delete product -->
36+
<deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/>
37+
<!-- Delete category -->
38+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
39+
<!-- Delete customer -->
40+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
41+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
42+
</after>
43+
44+
<!-- Login to storefront -->
45+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
46+
<argument name="Customer" value="$$createCustomer$$"/>
47+
</actionGroup>
48+
49+
<!-- Open product page -->
50+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
51+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
52+
</actionGroup>
53+
54+
<!-- Upload file -->
55+
<actionGroup ref="StorefrontAttachOptionFileActionGroup" stepKey="selectAndAttachFile">
56+
<argument name="optionTitle" value="{{ProductOptionFile.title}}"/>
57+
<argument name="file" value="ProductFileOptionWithScriptTag.file"/>
58+
</actionGroup>
59+
60+
<!-- Add product to cart -->
61+
<click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCartButton"/>
62+
<waitForPageLoad stepKey="waitForProductAddToCart"/>
63+
64+
<!-- Assert alert message -->
65+
<waitForElementVisible selector="{{StorefrontProductPageSection.alertMessage}}" stepKey="waitForElementVisible"/>
66+
<see selector="{{StorefrontProductPageSection.alertMessage}}" userInput="The file is empty. Please choose another one" stepKey="seeAlertMessage"/>
67+
68+
<!-- Assert cart is empty -->
69+
<actionGroup ref="AssertMiniCartEmpty" stepKey="assertMiniCartEmpty"/>
70+
</test>
71+
</tests>

0 commit comments

Comments
 (0)