Skip to content

Commit ea6b7f4

Browse files
authored
ENGCOM-6818: Issue #24842: Unable to delete custom option file in admin order create #24843
2 parents 6bcfa3d + 9390ccb commit ea6b7f4

File tree

6 files changed

+120
-1
lines changed

6 files changed

+120
-1
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require(['prototype'], function(){
2222
initializeFile: function(inputBox) {
2323
this.inputFile = inputBox.select('input[name="<?= /* @noEscape */ $_fileName ?>"]')[0];
2424
this.inputFileAction = inputBox.select('input[name="<?= /* @noEscape */ $_fieldNameAction ?>"]')[0];
25-
this.fileNameBox = inputBox.up('dd').select('.<?= /* @noEscape */ $_fileNamed ?>')[0];
25+
this.fileNameBox = inputBox.up('div').select('.<?= /* @noEscape */ $_fileNamed ?>')[0];
2626
},
2727

2828
toggleFileChange: function(inputBox) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminAddSimpleProductWithCustomOptionFileToOrderActionGroup" extends="AddSimpleProductToOrderActionGroup">
11+
<annotations>
12+
<description>Add product to order with custom option type file. Start on create order page.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="file" type="string" defaultValue="{{TestImageNew.file}}" />
16+
</arguments>
17+
18+
<remove keyForRemoval="fillProductQty"/>
19+
<waitForAjaxLoad stepKey="waitForAjaxLoad" after="selectProduct"/>
20+
<fillField selector="{{AdminOrderFormCustomOptionsSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty" after="waitForAjaxLoad"/>
21+
<attachFile selector="{{AdminOrderFormCustomOptionsSection.file}}" userInput="{{file}}" stepKey="attachImageForOptional" after="fillProductQty"/>
22+
<click selector="{{AdminOrderFormCustomOptionsSection.buttonOk}}" stepKey="clickButtonOK" after="attachImageForOptional"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminChangeCustomerOptionFileActionGroup">
11+
<annotations>
12+
<description>Change custom option file on admin order page.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="file" type="string" defaultValue="{{TestImageNew.file}}" />
16+
</arguments>
17+
18+
<click selector="{{AdminOrderFormItemsSection.configure}}" stepKey="clickConfigure"/>
19+
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
20+
<click selector="{{AdminOrderFormCustomOptionsSection.linkChange}}" stepKey="clickLinkChange"/>
21+
<waitForPageLoad stepKey="waitForChangeLoad"/>
22+
<attachFile selector="{{AdminOrderFormCustomOptionsSection.file}}" userInput="{{file}}" stepKey="changeAttachImage"/>
23+
<click selector="{{AdminOrderFormCustomOptionsSection.buttonOk}}" stepKey="clickButtonOK"/>
24+
<waitForPageLoad stepKey="waitForCustomOptionApplied"/>
25+
</actionGroup>
26+
</actionGroups>

app/code/Magento/Sales/Test/Mftf/Page/AdminOrderCreatePage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
<section name="AdminOrderFormStoreSelectorSection"/>
2121
<section name="AdminOrderFormDiscountSection"/>
2222
<section name="AdminOrderFormMessagesSection"/>
23+
<section name="AdminOrderFormCustomOptionsSection"/>
2324
</page>
2425
</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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
<section name="AdminOrderFormCustomOptionsSection">
11+
<element name="quantity" type="input" selector="//input[@id='product_composite_configure_input_qty']"/>
12+
<element name="file" type="file" selector="//input[@type='file'][contains(@class, 'product-custom-option')]" />
13+
<element name="buttonOk" type="button" selector="//button[contains(@class, 'action-primary')][@data-role='action']"/>
14+
<element name="linkChange" type="text" selector="//div[contains(@class, 'entry-edit')]//a[contains(text(),'Change')]"/>
15+
</section>
16+
</sections>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateOrderWithSimpleProductCustomOptionFileTest">
11+
<annotations>
12+
<title value="Create Order with simple product with custom option."/>
13+
<description value="Verify, admin able to change file for custom option during order creation."/>
14+
<features value="Sales"/>
15+
<severity value="MAJOR"/>
16+
<group value="Sales"/>
17+
</annotations>
18+
<before>
19+
<!--Create test data.-->
20+
<createData entity="_defaultCategory" stepKey="category"/>
21+
<createData entity="SimpleProduct" stepKey="simpleProduct">
22+
<requiredEntity createDataKey="category"/>
23+
</createData>
24+
<createData entity="Simple_US_Customer_CA" stepKey="customer"/>
25+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
26+
</before>
27+
<after>
28+
<!--Clean up created test data.-->
29+
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
30+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
31+
<deleteData createDataKey="customer" stepKey="deleteCustomer" />
32+
<actionGroup ref="logout" stepKey="logout"/>
33+
</after>
34+
35+
<!--Add option to product.-->
36+
<amOnPage url="{{AdminProductEditPage.url($simpleProduct.id$)}}" stepKey="navigateToProductEditPage"/>
37+
<actionGroup ref="AddProductCustomOptionFileActionGroup" stepKey="addOption">
38+
<argument name="option" value="ProductOptionFile"/>
39+
</actionGroup>
40+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
41+
<!--Create order.-->
42+
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer">
43+
<argument name="customer" value="$customer$"/>
44+
</actionGroup>
45+
<actionGroup ref="AdminAddSimpleProductWithCustomOptionFileToOrderActionGroup" stepKey="addSimpleProductToOrder">
46+
<argument name="product" value="$simpleProduct$"/>
47+
<argument name="productQty" value="$simpleProduct.quantity$"/>
48+
</actionGroup>
49+
<!--Verify, admin able to change file for custom option.-->
50+
<actionGroup ref="AdminChangeCustomerOptionFileActionGroup" stepKey="changeFile"/>
51+
</test>
52+
</tests>

0 commit comments

Comments
 (0)