Skip to content

Commit 90b054d

Browse files
Merge branch 'ACQE-8277' into ACQE-functional-deployment-version11
2 parents fab20b0 + 2960e77 commit 90b054d

File tree

6 files changed

+123
-0
lines changed

6 files changed

+123
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<actionGroups
10+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
12+
<actionGroup name="StorefrontVerifyErrorMessageDisplayedWhileAddingProductWithEmptyFileToCartActionGroup" extends="AddToCartFromStorefrontProductPageActionGroup">
13+
<arguments>
14+
<argument name="productName" type="string"/>
15+
</arguments>
16+
<remove keyForRemoval="waitForSuccessMessage"/>
17+
<remove keyForRemoval="seeAddToCartSuccessMessage"/>
18+
<waitForText selector="{{StorefrontProductInfoMainSection.customEmptyFileValidationMessage}}" userInput="{{EmptyFileValidationMessage.fileValidationMessage}}" stepKey="verifyEmptyFileValidationMessage"/>
19+
</actionGroup>
20+
</actionGroups>

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,4 +450,21 @@
450450
<entity name="ProductRadioButtonType" type="product_option">
451451
<data key="type">Radio Buttons</data>
452452
</entity>
453+
<entity name="ProductOptionTextFile" type="product_option">
454+
<var key="product_sku" entityType="product" entityKey="sku" />
455+
<data key="title">OptionFile</data>
456+
<data key="type">file</data>
457+
<data key="is_require">true</data>
458+
<data key="sort_order">3</data>
459+
<data key="price">9.99</data>
460+
<data key="price_type">fixed</data>
461+
<data key="file_extension">txt</data>
462+
</entity>
463+
<entity name="EmptyFiles">
464+
<data key="file1">emptyTxtFile.txt</data>
465+
<data key="file2">emptyPngFile.png</data>
466+
</entity>
467+
<entity name="EmptyFileValidationMessage">
468+
<data key="fileValidationMessage">The file is empty. Select another file and try again.</data>
469+
</entity>
453470
</entities>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,6 @@
117117
<element name="productCalenderButton" type="button" selector="//*[@id='product-options-wrapper']/div/div/fieldset/div/button" />
118118
<element name="productCalenderGoToday" type="button" selector="//*[@id='ui-datepicker-div']/div[2]/button[1]" />
119119
<element name="customDateField" type="text" selector='//*[@class="product-custom-option datetime-picker input-text _has-datepicker"]' />
120+
<element name="customEmptyFileValidationMessage" type="text" selector="//div[@data-ui-id='message-error']/div"/>
120121
</section>
121122
</sections>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<tests
10+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
12+
<test name="StoreFrontUseEmptyFileAsACustomOptionOfFileTypeTest">
13+
<annotations>
14+
<features value="Catalog"/>
15+
<stories value="Empty file as a custom option for the file type"/>
16+
<title value="Product custom options"/>
17+
<description value="Verify the validation of an empty file as a custom option for the file type."/>
18+
<severity value="MAJOR"/>
19+
<testCaseId value="AC-3848"/>
20+
<group value="catalog"/>
21+
</annotations>
22+
<before>
23+
<!-- Pre-condition 1:Create Simple Product -->
24+
<createData entity="defaultSimpleProduct" stepKey="initialSimpleProduct"/>
25+
</before>
26+
<after>
27+
<!-- Delete product, Logout from Admin -->
28+
<deleteData createDataKey="initialSimpleProduct" stepKey="deleteSimpleProduct"/>
29+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
30+
</after>
31+
<!-- Login As Admin -->
32+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
33+
<!-- Step1: Open a product page in Admin and Open Customizable options tab.-->
34+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductForEdit">
35+
<argument name="productId" value="$initialSimpleProduct.id$"/>
36+
</actionGroup>
37+
<!-- Open custom option panel -->
38+
<click selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="openCustomizableOptions"/>
39+
<waitForPageLoad stepKey="waitForCustomOptionsOpen"/>
40+
<!-- Step2: Add Custom file option -->
41+
<actionGroup ref="AddProductCustomOptionFileActionGroup" stepKey="addFileOption">
42+
<argument name="option" value="ProductOptionTextFile"/>
43+
</actionGroup>
44+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
45+
<!-- Step3: Open the product on Storefront -->
46+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
47+
<argument name="productUrl" value="$$initialSimpleProduct.custom_attributes[url_key]$$"/>
48+
</actionGroup>
49+
<!-- Step4: Upload an empty file -->
50+
<actionGroup ref="StorefrontAttachOptionFileActionGroup" stepKey="selectAndAttachFile">
51+
<argument name="file" value="EmptyFiles.file1" />
52+
</actionGroup>
53+
<!--Step4 Assertion: Verify An error should be displayed when adding to cart -->
54+
<actionGroup ref="StorefrontVerifyErrorMessageDisplayedWhileAddingProductWithEmptyFileToCartActionGroup" stepKey="addProductToCart">
55+
<argument name="productName" value="$initialSimpleProduct.name$"/>
56+
</actionGroup>
57+
<!-- Open product in admin and delete existing custom option-->
58+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEditPage">
59+
<argument name="productId" value="$initialSimpleProduct.id$"/>
60+
</actionGroup>
61+
<!-- Open custom option panel -->
62+
<click selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" stepKey="openCustomizableOption"/>
63+
<waitForPageLoad stepKey="waitForCustomOptionOpen"/>
64+
<actionGroup ref="AdminDeleteProductCustomOptionActionGroup" stepKey="deleteCustomOptionFile">
65+
<argument name="option" value="ProductOptionTextFile"/>
66+
</actionGroup>
67+
<!-- Step5: Add a new custom option of File type that accepts only images-->
68+
<actionGroup ref="AddProductCustomOptionFileActionGroup" stepKey="addFileOptions">
69+
<argument name="option" value="ProductOptionFile"/>
70+
</actionGroup>
71+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveTheProduct"/>
72+
<!-- Step6: Open Product page in storeFront -->
73+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openTheProductPage">
74+
<argument name="productUrl" value="$$initialSimpleProduct.custom_attributes[url_key]$$"/>
75+
</actionGroup>
76+
<!--Step7: Upload an empty image -->
77+
<actionGroup ref="StorefrontAttachOptionFileActionGroup" stepKey="selectAndAttachTheFile">
78+
<argument name="file" value="EmptyFiles.file2" />
79+
</actionGroup>
80+
<!-- Step7 Assertion: Verify An error should be displayed when adding to cart -->
81+
<actionGroup ref="StorefrontVerifyErrorMessageDisplayedWhileAddingProductWithEmptyFileToCartActionGroup" stepKey="addTheProductToCart">
82+
<argument name="productName" value="$initialSimpleProduct.name$"/>
83+
</actionGroup>
84+
</test>
85+
</tests>

dev/tests/acceptance/tests/_data/emptyPngFile.png

Loading

dev/tests/acceptance/tests/_data/emptyTxtFile.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)