Skip to content

Commit e67ae1b

Browse files
author
Stas Puga
committed
MAGETWO-97029: Product image assignment for multiple stores
1 parent a9ea087 commit e67ae1b

13 files changed

+234
-8
lines changed

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontCategoryProductSection.xml

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

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontCategoryProductSection">
1212
<element name="priceToByProductId" type="text" selector="div[data-product-id='{{id}}'] .price-to" parameterized="true"/>
1313
<element name="priceFromByProductId" type="text" selector="div[data-product-id='{{id}}'] .price-from" parameterized="true"/>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!-- Assign Image role in admin product page -->
12+
<actionGroup name="AdminAssignImageRolesActionGroup">
13+
<arguments>
14+
<argument name="image"/>
15+
</arguments>
16+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggleState('closed')}}" dependentSelector="{{AdminProductImagesSection.productImagesToggleState('open')}}" visible="false" stepKey="clickSectionImage"/>
17+
<click selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="clickProductImage"/>
18+
<waitForElementVisible selector="{{AdminProductImagesSection.altText}}" stepKey="seeAltTextSection"/>
19+
<checkOption selector="{{AdminProductImagesSection.roleImage('Base')}}" stepKey="checkRoleBase"/>
20+
<checkOption selector="{{AdminProductImagesSection.roleImage('Small')}}" stepKey="checkRoleSmall"/>
21+
<checkOption selector="{{AdminProductImagesSection.roleImage('Thumbnail')}}" stepKey="checkRoleThumbnail"/>
22+
<checkOption selector="{{AdminProductImagesSection.roleImage('Swatch')}}" stepKey="checkRoleSwatch"/>
23+
<click selector="{{AdminSlideOutDialogSection.closeButton}}" stepKey="clickCloseButton"/>
24+
</actionGroup>
25+
</actionGroups>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,18 @@
283283
</arguments>
284284
<amOnPage url="{{AdminProductEditPage.url(productId)}}" stepKey="goToProduct"/>
285285
</actionGroup>
286+
287+
<!-- Change any product data product description You should be on product page -->
288+
<actionGroup name="AdminChangeProductDescriptionActionGroup">
289+
<arguments>
290+
<argument name="description" type="string"/>
291+
</arguments>
292+
<conditionalClick selector="{{AdminProductContentSection.sectionHeader}}" dependentSelector="{{AdminProductContentSection.sectionHeader}}" visible="true" stepKey="openDescriptionDropDown"/>
293+
<fillField selector="{{AdminProductContentSection.descriptionTextArea}}" userInput="{{description}}" stepKey="fillLongDescription"/>
294+
</actionGroup>
295+
<!-- Change any product data product short description You should be on product page -->
296+
<actionGroup name="AdminChangeProductShortDescriptionActionGroup" extends="AdminChangeProductDescriptionActionGroup">
297+
<remove keyForRemoval="fillLongDescription"/>
298+
<fillField selector="{{AdminProductContentSection.shortDescriptionTextArea}}" userInput="{{description}}" stepKey="fillShortDescription"/>
299+
</actionGroup>
286300
</actionGroups>

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,15 @@
9191
<seeInTitle userInput="{{subCategory.name}}" stepKey="assertCategoryNameInTitle"/>
9292
<see userInput="{{subCategory.name}}" selector="{{StorefrontCategoryMainSection.categoryTitle}}" stepKey="assertCategoryName"/>
9393
</actionGroup>
94+
<!-- Assert product store view image in storefront category page -->
95+
<actionGroup name="AssertStorefrontActiveImageCategoryActionGroup">
96+
<arguments>
97+
<argument name="category"/>
98+
<argument name="product"/>
99+
<argument name="image" type="string"/>
100+
</arguments>
101+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(category.name)}}" stepKey="openCategoryPage"/>
102+
<waitForPageLoad time="30" stepKey="waitForCategoryPage"/>
103+
<seeElement selector="{{StorefrontCategoryProductSection.ProductImageByNameAndSrc(product.name, image)}}" stepKey="seeImage"/>
104+
</actionGroup>
94105
</actionGroups>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,11 @@
3434
<seeElement selector="{{StorefrontProductMediaSection.imageFile(image)}}" stepKey="seeImage"/>
3535
<see userInput="{{price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="seeProductPrice"/>
3636
</actionGroup>
37+
<!-- Assert image Store View in storefront product page -->
38+
<actionGroup name="AssertStorefrontActiveImageProductActionGroup">
39+
<arguments>
40+
<argument name="image" type="string"/>
41+
</arguments>
42+
<seeElement selector="{{StorefrontProductMediaSection.productImageActive(image)}}" stepKey="seeActiveImage"/>
43+
</actionGroup>
3744
</actionGroups>

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,4 +324,13 @@
324324
<data key="weight">1</data>
325325
<requiredEntity type="product_extension_attribute">EavStock100</requiredEntity>
326326
</entity>
327+
<entity name="Magento3" type="image">
328+
<data key="title" unique="suffix">Magento3</data>
329+
<data key="price">1.00</data>
330+
<data key="file_type">Upload File</data>
331+
<data key="shareable">Yes</data>
332+
<data key="file">magento3.jpg</data>
333+
<data key="filename">magento3</data>
334+
<data key="file_extension">jpg</data>
335+
</entity>
327336
</entities>

app/code/Magento/Catalog/Test/Mftf/Page/AdminProductCreatePage.xml

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

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
1111
<page name="AdminProductCreatePage" url="catalog/product/new/set/{{set}}/type/{{type}}/" area="admin" module="Magento_Catalog" parameterized="true">
1212
<section name="AdminProductFormSection"/>
1313
<section name="AdminProductFormActionSection"/>
@@ -18,6 +18,7 @@
1818
<section name="AdminProductCustomizableOptionsSection" />
1919
<section name="AdminAddProductsToOptionPanelSection" />
2020
<section name="AdminProductFormAdvancedPricingSection"/>
21+
<section name="AdminProductContentSection"/>
2122
<section name="AdminProductCustomizableOptionsImportModalSection"/>
2223
</page>
2324
</pages>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminProductContentSection">
12+
<element name="sectionHeader" type="button" selector="div[data-index='content']" timeout="30"/>
13+
<element name="descriptionTextArea" type="textarea" selector="div[data-index='content'] #product_form_description"/>
14+
<element name="shortDescriptionTextArea" type="textarea" selector="div[data-index='content'] #product_form_short_description"/>
15+
</section>
16+
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductImagesSection.xml

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

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductImagesSection">
1212
<element name="productImagesToggle" type="button" selector="div[data-index=gallery] .admin__collapsible-title"/>
1313
<element name="imageFileUpload" type="input" selector="#fileupload"/>
@@ -16,5 +16,8 @@
1616
<element name="removeImageButton" type="button" selector=".action-remove"/>
1717
<element name="modalOkBtn" type="button" selector="button.action-primary.action-accept"/>
1818
<element name="uploadProgressBar" type="text" selector=".uploader .file-row"/>
19+
<element name="productImagesToggleState" type="button" selector="[data-index='gallery'] > [data-state-collapsible='{{status}}']" parameterized="true"/>
20+
<element name="altText" type="textarea" selector=".image-panel textarea[data-role='image-description']"/>
21+
<element name="roleImage" type="button" selector="//div[contains(@class, 'field-image-role')]//ul/li/label[normalize-space(.) = '{{roleImage}}']" parameterized="true"/>
1922
</section>
2023
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml

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

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontProductMediaSection">
1212
<element name="imageFile" type="text" selector=".product.media img[src*='{{filename}}']" parameterized="true"/>
13+
<element name="productImageActive" type="text" selector=".product.media div[data-active=true] > img[src*='{{filename}}']" parameterized="true"/>
1314
</section>
1415
</sections>

0 commit comments

Comments
 (0)