Skip to content

Issue #24842: Unable to delete custom option file in admin order create #24843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require(['prototype'], function(){
initializeFile: function(inputBox) {
this.inputFile = inputBox.select('input[name="<?= /* @noEscape */ $_fileName ?>"]')[0];
this.inputFileAction = inputBox.select('input[name="<?= /* @noEscape */ $_fieldNameAction ?>"]')[0];
this.fileNameBox = inputBox.up('dd').select('.<?= /* @noEscape */ $_fileNamed ?>')[0];
this.fileNameBox = inputBox.up('div').select('.<?= /* @noEscape */ $_fileNamed ?>')[0];
},

toggleFileChange: function(inputBox) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminAddSimpleProductWithCustomOptionFileToOrderActionGroup" extends="AddSimpleProductToOrderActionGroup">
<annotations>
<description>Add product to order with custom option type file. Start on create order page.</description>
</annotations>
<arguments>
<argument name="file" type="string" defaultValue="{{TestImageNew.file}}" />
</arguments>

<remove keyForRemoval="fillProductQty"/>
<waitForAjaxLoad stepKey="waitForAjaxLoad" after="selectProduct"/>
<fillField selector="{{AdminOrderFormCustomOptionsSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQty" after="waitForAjaxLoad"/>
<attachFile selector="{{AdminOrderFormCustomOptionsSection.file}}" userInput="{{file}}" stepKey="attachImageForOptional" after="fillProductQty"/>
<click selector="{{AdminOrderFormCustomOptionsSection.buttonOk}}" stepKey="clickButtonOK" after="attachImageForOptional"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminChangeCustomerOptionFileActionGroup">
<annotations>
<description>Change custom option file on admin order page.</description>
</annotations>
<arguments>
<argument name="file" type="string" defaultValue="{{TestImageNew.file}}" />
</arguments>

<click selector="{{AdminOrderFormItemsSection.configure}}" stepKey="clickConfigure"/>
<waitForAjaxLoad stepKey="waitForAjaxLoad"/>
<click selector="{{AdminOrderFormCustomOptionsSection.linkChange}}" stepKey="clickLinkChange"/>
<waitForPageLoad stepKey="waitForChangeLoad"/>
<attachFile selector="{{AdminOrderFormCustomOptionsSection.file}}" userInput="{{file}}" stepKey="changeAttachImage"/>
<click selector="{{AdminOrderFormCustomOptionsSection.buttonOk}}" stepKey="clickButtonOK"/>
<waitForPageLoad stepKey="waitForCustomOptionApplied"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
<section name="AdminOrderFormStoreSelectorSection"/>
<section name="AdminOrderFormDiscountSection"/>
<section name="AdminOrderFormMessagesSection"/>
<section name="AdminOrderFormCustomOptionsSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminOrderFormCustomOptionsSection">
<element name="quantity" type="input" selector="//input[@id='product_composite_configure_input_qty']"/>
<element name="file" type="file" selector="//input[@type='file'][contains(@class, 'product-custom-option')]" />
<element name="buttonOk" type="button" selector="//button[contains(@class, 'action-primary')][@data-role='action']"/>
<element name="linkChange" type="text" selector="//div[contains(@class, 'entry-edit')]//a[contains(text(),'Change')]"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCreateOrderWithSimpleProductCustomOptionFileTest">
<annotations>
<title value="Create Order with simple product with custom option."/>
<description value="Verify, admin able to change file for custom option during order creation."/>
<features value="Sales"/>
<severity value="MAJOR"/>
<group value="Sales"/>
</annotations>
<before>
<!--Create test data.-->
<createData entity="_defaultCategory" stepKey="category"/>
<createData entity="SimpleProduct" stepKey="simpleProduct">
<requiredEntity createDataKey="category"/>
</createData>
<createData entity="Simple_US_Customer_CA" stepKey="customer"/>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<!--Clean up created test data.-->
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
<deleteData createDataKey="category" stepKey="deleteCategory"/>
<deleteData createDataKey="customer" stepKey="deleteCustomer" />
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!--Add option to product.-->
<amOnPage url="{{AdminProductEditPage.url($simpleProduct.id$)}}" stepKey="navigateToProductEditPage"/>
<actionGroup ref="AddProductCustomOptionFileActionGroup" stepKey="addOption">
<argument name="option" value="ProductOptionFile"/>
</actionGroup>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
<!--Create order.-->
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderWithExistingCustomer">
<argument name="customer" value="$customer$"/>
</actionGroup>
<actionGroup ref="AdminAddSimpleProductWithCustomOptionFileToOrderActionGroup" stepKey="addSimpleProductToOrder">
<argument name="product" value="$simpleProduct$"/>
<argument name="productQty" value="$simpleProduct.quantity$"/>
</actionGroup>
<!--Verify, admin able to change file for custom option.-->
<actionGroup ref="AdminChangeCustomerOptionFileActionGroup" stepKey="changeFile"/>
</test>
</tests>