Skip to content

Commit c70c547

Browse files
Chhandak.Baruadevarul
authored andcommitted
ACP2E-1479: Product with any custom option causes an error when deleting product images
1 parent 62b1bc8 commit c70c547

File tree

2 files changed

+45
-31
lines changed

2 files changed

+45
-31
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<actionGroup name="VerifySuccessMessagesWithoutNotificationActionGroup">
12+
<annotations>
13+
<description>Verify the success messages without notification post product save and see the product image is deleted.</description>
14+
</annotations>
15+
16+
<arguments>
17+
<argument name="image" defaultValue="ProductImage"/>
18+
</arguments>
19+
<waitForPageLoad stepKey="waitForProductPageLoad1"/>
20+
<!--Verify notification and success messages-->
21+
<see selector="{{StorefrontMessagesSection.success}}" userInput="{{ProductFormMessages.save_success}}" stepKey="seeSuccessMessage"/>
22+
<dontSee selector="{{StorefrontMessagesSection.noticeMessage}}" userInput="{{ProductFormMessages.remove_image_notice}}" stepKey="seeNotification"/>
23+
<!--Reopen image tab and see the image is deleted-->
24+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesTab"/>
25+
<waitForPageLoad stepKey="waitForImagesLoad"/>
26+
<dontSeeElement selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="seeImageIsNotDeleted"/>
27+
</actionGroup>
28+
</actionGroups>

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

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,57 +20,43 @@
2020
<group value="Catalog"/>
2121
</annotations>
2222
<before>
23-
<!--Login as admin-->
2423
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
25-
<createData entity="SimpleProduct2" stepKey="createProduct"/>
26-
<createData entity="SubCategory" stepKey="createSubCategory"/>
27-
<createData entity="NewRootCategory" stepKey="createRootCategory"/>
28-
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="visitAdminProductPage">
29-
<argument name="productId" value="$$createProduct.id$$"/>
30-
</actionGroup>
31-
<waitForPageLoad stepKey="waitForProductPageLoad0"/>
24+
<createData entity="ApiCategory" stepKey="category"/>
25+
<!--Create product with small, base, and thumbnail image-->
26+
<createData entity="ApiSimpleProduct" stepKey="productWithImages">
27+
<requiredEntity createDataKey="category"/>
28+
</createData>
29+
<updateData createDataKey="productWithImages" entity="productWithOptions2" stepKey="updateProductWithCustomOption"/>
3230
<!--Add images to the product-->
3331
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="visitAdminProductPage2">
34-
<argument name="productId" value="$$createProduct.id$$"/>
32+
<argument name="productId" value="$$productWithImages.id$$"/>
3533
</actionGroup>
3634
<waitForPageLoad stepKey="waitForProductPageLoad1"/>
3735
<actionGroup ref="AddProductImageActionGroup" stepKey="addImageToProduct">
3836
<argument name="image" value="ProductImage"/>
3937
</actionGroup>
40-
<!-- opens the custom option panel and clicks add options -->
41-
<click stepKey="openCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}"/>
42-
<waitForPageLoad stepKey="waitForCustomOptionsOpen"/>
43-
44-
<!-- Create a custom option with 2 values -->
45-
<actionGroup ref="CreateCustomRadioOptionsActionGroup" stepKey="createCustomOption1">
46-
<argument name="customOptionName" value="ProductOptionRadiobutton.title"/>
47-
<argument name="productOption" value="ProductOptionField"/>
48-
<argument name="productOption2" value="ProductOptionField2"/>
49-
</actionGroup>
5038
<waitForPageLoad stepKey="waitForProductPageLoad2"/>
5139
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct1"/>
5240
</before>
5341
<after>
54-
<deleteData createDataKey="createSubCategory" stepKey="deleteSubCategory"/>
55-
<deleteData createDataKey="createRootCategory" stepKey="deleteRootCategory"/>
56-
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
42+
<!--Delete prerequisite entities-->
43+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
44+
<deleteData createDataKey="productWithImages" stepKey="deleteProductWithImages"/>
5745
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
5846
</after>
5947
<!--Open product page on admin-->
6048
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPage">
61-
<argument name="productId" value="$$createProduct.id$$"/>
49+
<argument name="productId" value="$$productWithImages.id$$"/>
6250
</actionGroup>
51+
<waitForPageLoad stepKey="waitForProductPageLoad1"/>
6352
<!--Remove product image and save-->
64-
<actionGroup ref="RemoveProductImageByNameActionGroup" stepKey="removeProductImage">
53+
<actionGroup ref="RemoveProductImageByNameActionGroup" stepKey="removeProductFromCart2">
6554
<argument name="image" value="ProductImage"/>
6655
</actionGroup>
6756
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct5"/>
68-
<!--Assert notification and success messages-->
69-
<see selector="{{StorefrontMessagesSection.success}}" userInput="{{ProductFormMessages.save_success}}" stepKey="seeSuccessMessage"/>
70-
<dontSee selector="{{StorefrontMessagesSection.noticeMessage}}" userInput="{{ProductFormMessages.remove_image_notice}}" stepKey="seeNotification"/>
71-
<!--Reopen image tab and see the image is not deleted-->
72-
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesTab"/>
73-
<waitForPageLoad stepKey="waitForImagesLoad"/>
74-
<dontSeeElement selector="{{AdminProductImagesSection.imageFile(ProductImage.fileName)}}" stepKey="seeImageIsNotDeleted"/>
57+
<!--Verify the success messages without notification-->
58+
<actionGroup ref="VerifySuccessMessagesWithoutNotificationActionGroup" stepKey="verifySuccessMessages">
59+
<argument name="image" value="ProductImage"/>
60+
</actionGroup>
7561
</test>
7662
</tests>

0 commit comments

Comments
 (0)