Skip to content

Commit

Permalink
Cover MFTF test
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Echo committed Feb 7, 2020
1 parent 3eb4110 commit 6e4a041
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 0 deletions.
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>

0 comments on commit 6e4a041

Please sign in to comment.