Skip to content

Commit

Permalink
Merge pull request magento#114 from magento-pangolin/MC-4776
Browse files Browse the repository at this point in the history
MC-4776
  • Loading branch information
tomreece authored May 16, 2019
2 parents 3acf193 + 8eed6a5 commit c383b4c
Show file tree
Hide file tree
Showing 14 changed files with 285 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<element name="productCustomOptions" type="text" selector="//strong[contains(@class, 'product-item-name') and normalize-space(.)='{{var1}}']/following-sibling::*[contains(@class, 'item-options')]/dt[normalize-space(.)='{{var2}}']/following-sibling::dd[normalize-space(.)='{{var3}}']" parameterized="true"/>
<element name="productCustomOptionsFile" type="text" selector="//strong[contains(@class, 'product-item-name') and normalize-space(.)='{{var1}}']/following-sibling::*[contains(@class, 'item-options')]/dt[normalize-space(.)='{{var2}}']/following-sibling::dd[contains(.,'{{var3}}')]" parameterized="true"/>
<element name="productCustomOptionsLink" type="text" selector="//strong[contains(@class, 'product-item-name') and normalize-space(.)='{{var1}}']/following-sibling::*[contains(@class, 'item-options')]/dt[normalize-space(.)='{{var2}}']/following-sibling::dd//a[text() = '{{var3}}']" parameterized="true"/>
<element name="status" type="text" selector="//td[contains(concat(' ',normalize-space(@class),' '),' col status ')]"/>
<element name="viewOrder" type="button" selector="//td[contains(concat(' ',normalize-space(@class),' '),' col actions ')]/a[contains(concat(' ',normalize-space(@class),' '),' action view ')]"/>
<element name="tabRefund" type="button" selector="//a[text()='Refunds']"/>
<element name="grandTotalRefund" type="text" selector="td[data-th='Grand Total'] > strong > span.price"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<actionGroup name="FilterOrderStatusByLabelAndCodeActionGroup">
<arguments>
<argument name="statusLabel" type="string"/>
<argument name="statusCode" type="string"/>
</arguments>
<conditionalClick selector="{{AdminOrderStatusGridSection.resetFilter}}" dependentSelector="{{AdminOrderStatusGridSection.resetFilter}}" visible="true" stepKey="clearOrderStatusFilters" />
<fillField selector="{{AdminOrderStatusGridSection.statusLabel}}" userInput="{{statusLabel}}" stepKey="fillStatusLabel"/>
<fillField selector="{{AdminOrderStatusGridSection.statusCode}}" userInput="{{statusCode}}" stepKey="fillStatusCode"/>
<click selector="{{AdminOrderStatusGridSection.search}}" stepKey="clickSearch"/>
<waitForPageLoad stepKey="waitForSearch"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<actionGroup name="SelectActionForOrdersActionGroup">
<arguments>
<argument name="action" type="string"/>
</arguments>
<checkOption selector="{{AdminOrdersGridSection.checkOrder}}" stepKey="checkOrder"/>
<click selector="{{AdminOrdersGridSection.orderActions}}" stepKey="clickOrderActions"/>
<click selector="{{AdminOrdersGridSection.changeOrderStatus(action)}}" stepKey="changeOrdersAction"/>
</actionGroup>
</actionGroups>
21 changes: 21 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Data/OrderActionsData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="OrderActions" type="orderActions">
<data key="cancel">Cancel</data>
<data key="hold">Hold</data>
<data key="unhold">Unhold</data>
<data key="printInvoices">Print Invoices</data>
<data key="printPackingSlips">Print Packing Slips</data>
<data key="printCreditMemos">Print Credit Memos</data>
<data key="printAll">Print All</data>
<data key="printShippingLabels">Print Shipping Labels</data>
</entity>
</entities>
21 changes: 21 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Data/OrderStateData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="OrderState" type="state">
<data key="canceled">Canceled</data>
<data key="closed">Closed</data>
<data key="complete">Complete</data>
<data key="payment_review">Payment Review</data>
<data key="processing">Processing</data>
<data key="holded">On Hold</data>
<data key="new">Pending</data>
<data key="pending_payment">Pending Payment</data>
</entity>
</entities>
18 changes: 18 additions & 0 deletions app/code/Magento/Sales/Test/Mftf/Data/OrderStatusConfigData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="EnableCheckmoOrderStatusPending">
<data key="path">payment/checkmo/order_status</data>
<data key="scope">payment</data>
<data key="scope_id">1</data>
<data key="label">Pending</data>
<data key="value">pending</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
* 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">
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminAssignOrderStatusToStateSection">
<element name="orderStatus" type="select" selector="#container [name=status]"/>
<element name="orderState" type="select" selector="#container [name=state]"/>
<element name="orderStatus" type="select" selector="#status"/>
<element name="orderState" type="select" selector="#state"/>
<element name="orderStatusAsDefault" type="checkbox" selector="#is_default"/>
<element name="visibleOnStorefront" type="checkbox" selector="#visible_on_front"/>
<element name="saveStatusAssignment" type="button" selector="#save" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
<element name="statusCodeFilterField" type="input" selector="[data-role=filter-form] [name=status]"/>
<element name="statusCodeDataColumn" type="input" selector="[data-role=row] [data-column=status]"/>
<element name="statusLabelDataColumn" type="input" selector="[data-role=row] [data-column=label]"/>
<element name="assignStatusToStateBtn" type="button" selector="#assign" timeout="30"/>
<element name="statusLabel" type="input" selector="#sales_order_status_grid_filter_label"/>
<element name="statusCode" type="input" selector="#sales_order_status_grid_filter_status"/>
<element name="resetFilter" type="button" selector="//div[contains(concat(' ',normalize-space(@class),' '),' action-reset ')]" timeout="30"/>
<element name="search" type="button" selector="[data-action='grid-filter-apply']" timeout="30"/>
<element name="gridCell" type="text" selector="//tr['{{row}}']//td[count(//div[contains(concat(' ',normalize-space(@class),' '),' admin__data-grid-wrap ')]//tr//th[contains(., '{{cellName}}')]/preceding-sibling::th) +1 ]" parameterized="true" timeout="30"/>
<element name="stateCodeAndTitleDataColumn" type="input" selector="[data-role=row] [data-column=state]"/>
<element name="assignStatusToStateButton" type="button" selector="#assign" timeout="30"/>
<element name="unassign" type="text" selector="[data-role=row] [data-column=unassign]"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<element name="viewColumnCheckbox" type="checkbox" selector="//div[contains(@class,'admin__data-grid-action-columns')]//div[contains(@class, 'admin__field-option')]//label[text() = '{{column}}']/preceding-sibling::input" parameterized="true"/>
<element name="customerInOrdersSection" type="button" selector="(//td[contains(text(),'{{customer}}')])[1]" parameterized="true"/>
<element name="productForOrder" type="button" selector="//td[contains(text(),'{{var}}')]" parameterized="true"/>
<element name="checkOrder" type="input" selector="//td[count(//div[@data-role='grid-wrapper'])]//input"/>
<element name="orderActions" type="button" selector="//div[contains(concat(' ',normalize-space(@class),' '),' row-gutter ')]//button[@title='Select Items']"/>
<element name="changeOrderStatus" type="button" selector="//div[contains(concat(' ',normalize-space(@class),' '),' row-gutter ')]//span[text()='{{status}}']" parameterized="true" timeout="30"/>
<element name="viewLink" type="text" selector="//td/div[contains(.,'{{orderID}}')]/../..//a[@class='action-menu-item']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
<section name="StorefrontOrderInformationMainSection">
<element name="orderTitle" type="span" selector="#page-title-wrapper"/>
<element name="return" type="span" selector="//span[contains(text(), 'Return')]"/>
<element name="emptyMessage" type="text" selector="//div[contains(concat(' ',normalize-space(@class),' '),' message info empty ')]/span"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<argument name="status" value="{{defaultOrderStatus.status}}"/>
<argument name="label" value="{{defaultOrderStatus.label}}"/>
</actionGroup>
<click selector="{{AdminOrderStatusGridSection.assignStatusToStateButton}}" stepKey="clickAssignStatusToStateButton"/>
<click selector="{{AdminOrderStatusGridSection.assignStatusToStateBtn}}" stepKey="clickAssignStatusToStateButton"/>
<waitForPageLoad stepKey="waitForAssignOrderStatusToStateLoad"/>
<selectOption selector="{{AdminAssignOrderStatusToStateSection.orderStatus}}" userInput="{{defaultOrderStatus.label}}" stepKey="selectOrderStatus"/>
<waitForPageLoad stepKey="waitForOrderStatusLoad"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?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="AssignCustomOrderStatusNotVisibleOnStorefrontTest">
<annotations>
<features value="Sales"/>
<stories value="Assign Custom Order Status"/>
<title value="Assign custom order status not visible on storefront test"/>
<description value="Assign custom order status not visible on storefront"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-16053"/>
<group value="sales"/>
<group value="mtf_migrated"/>
</annotations>
<before>
<!-- Create customer -->
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>

<!-- Create product -->
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<!-- Disable created order status -->
<magentoCLI command="config:set {{EnableCheckmoOrderStatusPending.path}} {{EnableCheckmoOrderStatusPending.value}}" stepKey="rollbackNewOrderStatus"/>

<!-- Logout customer -->
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>

<!-- Delete product -->
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>

<!-- Delete customer -->
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>

<!-- Log out -->
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!-- Create order status -->
<amOnPage url="{{AdminOrderStatusPage.url}}" stepKey="goToOrderStatusPage"/>
<waitForPageLoad stepKey="waitForOrderStatusPageLoad"/>
<click selector="{{AdminMainActionsSection.add}}" stepKey="clickCreateNewStatus"/>

<!-- Fill form and validate message -->
<actionGroup ref="AdminOrderStatusFormFillAndSave" stepKey="fillFormAndClickSave">
<argument name="status" value="{{defaultOrderStatus.status}}"/>
<argument name="label" value="{{defaultOrderStatus.label}}"/>
</actionGroup>
<actionGroup ref="AssertOrderStatusFormSaveSuccess" stepKey="seeFormSaveSuccess"/>

<!-- Assign status to state -->
<click selector="{{AdminOrderStatusGridSection.assignStatusToStateBtn}}" stepKey="clickAssignStatusBtn"/>
<selectOption selector="{{AdminAssignOrderStatusToStateSection.orderStatus}}" userInput="{{defaultOrderStatus.status}}" stepKey="selectOrderStatus"/>
<selectOption selector="{{AdminAssignOrderStatusToStateSection.orderState}}" userInput="{{OrderState.new}}" stepKey="selectOrderState"/>
<checkOption selector="{{AdminAssignOrderStatusToStateSection.orderStatusAsDefault}}" stepKey="orderStatusAsDefault"/>
<uncheckOption selector="{{AdminAssignOrderStatusToStateSection.visibleOnStorefront}}" stepKey="visibleOnStorefront"/>
<click selector="{{AdminAssignOrderStatusToStateSection.saveStatusAssignment}}" stepKey="clickSaveStatus"/>
<see selector="{{AdminMessagesSection.success}}" userInput="You assigned the order status." stepKey="seeSuccess"/>

<!-- Prepare data for constraints -->
<magentoCLI command="config:set {{EnableCheckmoOrderStatusPending.path}} {{defaultOrderStatus.label}}" stepKey="enableNewOrderStatus"/>

<!-- Assert order status in grid -->
<actionGroup ref="FilterOrderStatusByLabelAndCodeActionGroup" stepKey="filterOrderStatusGrid">
<argument name="statusLabel" value="{{defaultOrderStatus.label}}"/>
<argument name="statusCode" value="{{defaultOrderStatus.status}}"/>
</actionGroup>
<see selector="{{AdminOrderStatusGridSection.gridCell('1', 'State Code and Title')}}" userInput="new[{{defaultOrderStatus.label}}]" stepKey="seeOrderStatusInOrderGrid"/>

<!-- Create order and grab order id -->
<actionGroup ref="CreateOrderActionGroup" stepKey="createNewOrder">
<argument name="product" value="$$createSimpleProduct$$"/>
<argument name="customer" value="$$createCustomer$$"/>
</actionGroup>
<grabTextFrom selector="|Order # (\d+)|" stepKey="getOrderId"/>

<!-- Assert order status is correct -->
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersPage"/>
<waitForPageLoad stepKey="waitForOrdersPageLoad"/>
<actionGroup ref="filterOrderGridById" stepKey="filterOrdersGridById">
<argument name="orderId" value="$getOrderId"/>
</actionGroup>
<click selector="{{AdminDataGridTableSection.firstRow}}" stepKey="clickCreatedOrderInGrid"/>
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="{{defaultOrderStatus.label}}" stepKey="seeOrderStatus"/>

<!-- Login as customer -->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
<argument name="Customer" value="$$createCustomer$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForCustomerLogin"/>

<!-- Open My Orders -->
<amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="goToCustomerDashboardPage"/>
<waitForPageLoad stepKey="waitForCustomerDashboardPageLoad"/>
<actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToMyOrdersPage">
<argument name="menu" value="My Orders"/>
</actionGroup>

<!-- Assert order not visible on My Orders -->
<see selector="{{StorefrontOrderInformationMainSection.emptyMessage}}" userInput="You have placed no orders." stepKey="seeEmptyMessage"/>

<!-- Cancel order -->
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToAdminOrdersPage"/>
<waitForPageLoad stepKey="waitForAdminOrdersPageLoad"/>
<actionGroup ref="filterOrderGridById" stepKey="filterOrdersGridByOrderId">
<argument name="orderId" value="$getOrderId"/>
</actionGroup>
<checkOption selector="{{AdminOrdersGridSection.checkOrder}}" stepKey="selectOrder"/>
<actionGroup ref="SelectActionForOrdersActionGroup" stepKey="selectCancelOrderAction">
<argument name="action" value="{{OrderActions.cancel}}"/>
</actionGroup>
<see selector="{{AdminMessagesSection.success}}" userInput="We canceled 1 order(s)." stepKey="seeSuccessMessage"/>

<!-- Unassign order status -->
<amOnPage url="{{AdminOrderStatusPage.url}}" stepKey="goToOrderStatus"/>
<waitForPageLoad stepKey="waitForStatusPageLoad"/>
<actionGroup ref="FilterOrderStatusByLabelAndCodeActionGroup" stepKey="filterStatusGrid">
<argument name="statusLabel" value="{{defaultOrderStatus.label}}"/>
<argument name="statusCode" value="{{defaultOrderStatus.status}}"/>
</actionGroup>
<click selector="{{AdminOrderStatusGridSection.unassign}}" stepKey="unassignOrderStatus"/>
<see selector="{{AdminMessagesSection.success}}" userInput="You have unassigned the order status." stepKey="seeMessage"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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="AssignCustomOrderStatusVisibleOnStorefrontTest" extends="AssignCustomOrderStatusNotVisibleOnStorefrontTest">
<annotations>
<features value="Sales"/>
<stories value="Assign Custom Order Status"/>
<title value="Assign custom order status visible on storefront test"/>
<description value="Assign custom order status visible on storefront"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-16054"/>
<group value="sales"/>
<group value="mtf_migrated"/>
</annotations>
<remove keyForRemoval="seeEmptyMessage"/>

<!-- Assign status to state part -->
<checkOption selector="{{AdminAssignOrderStatusToStateSection.visibleOnStorefront}}" stepKey="visibleOnStorefront"/>

<!-- Assert order in orders grid on frontend -->
<see selector="{{StorefrontCustomerOrderSection.status}}" userInput="{{defaultOrderStatus.label}}" stepKey="seeOrderStatusOnStorefront" after="goToMyOrdersPage"/>
</test>
</tests>
Loading

0 comments on commit c383b4c

Please sign in to comment.