|
| 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> |
0 commit comments