From 7f2e4ad517e36a2e523b5cf8f094786b728797ea Mon Sep 17 00:00:00 2001
From: Leonid Poluyanov <lpoluyanov@magento.com>
Date: Thu, 4 Jan 2018 17:21:27 +0200
Subject: [PATCH] MAGETWO-85207: Customer's order grid is not displaying

---
 .../Cest/StorefrontCustomerCheckoutCest.xml       |  9 +++++++++
 .../Customer/Page/AdminEditCustomerPage.xml       | 15 +++++++++++++++
 .../Customer/Section/AdminCustomerGridSection.xml |  1 +
 .../AdminEditCustomerInformationSection.xml       | 14 ++++++++++++++
 .../Section/AdminEditCustomerOrdersSection.xml    | 14 ++++++++++++++
 5 files changed, 53 insertions(+)
 create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml
 create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminEditCustomerInformationSection.xml
 create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminEditCustomerOrdersSection.xml

diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Cest/StorefrontCustomerCheckoutCest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Cest/StorefrontCustomerCheckoutCest.xml
index 4531bfb84dc..4d7f78d572a 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Cest/StorefrontCustomerCheckoutCest.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Cest/StorefrontCustomerCheckoutCest.xml
@@ -80,6 +80,15 @@
             <see stepKey="s91" selector="{{OrderDetailsInformationSection.billingAddress}}" userInput="{{US_Address_TX.street[0]}}" />
             <see stepKey="s93" selector="{{OrderDetailsInformationSection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}}" />
             <see stepKey="s95" selector="{{OrderDetailsInformationSection.itemsOrdered}}" userInput="$$simpleproduct1.name$$" />
+            <amOnPage stepKey="s96" url="{{AdminCustomerPage.url}}"/>
+            <waitForPageLoad stepKey="s97"/>
+            <click stepKey="s98" selector="{{AdminCustomerFiltersSection.filtersButton}}"/>
+            <fillField stepKey="s99" selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="$$simpleuscustomer.email$$"/>
+            <click stepKey="s100" selector="{{AdminCustomerFiltersSection.apply}}"/>
+            <click stepKey="s101" selector="{{AdminCustomerGridSection.firstRowEditLink}}"/>
+            <click stepKey="s102" selector="{{AdminEditCustomerInformationSection.orders}}"/>
+            <see stepKey="s103" selector="{{AdminEditCustomerOrdersSection.orderGrid}}" variable="orderNumber" />
+            <see stepKey="s104" selector="{{AdminEditCustomerOrdersSection.orderGrid}}" userInput="$$simpleuscustomer.firstname$$ $$simpleuscustomer.lastname$$" />
         </test>
     </cest>
 </config>
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml
new file mode 100644
index 00000000000..ece0bd60e60
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Page/AdminEditCustomerPage.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ /**
+  * Copyright © Magento, Inc. All rights reserved.
+  * See COPYING.txt for license details.
+  */
+-->
+
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
+    <page name="AdminNewCustomerPage" url="/admin/customer/index/edit/id" module="Customer">
+        <section name="AdminEditCuctomerInformationSection"/>
+        <section name="AdminEditCustomerOrdersSection"/>
+    </page>
+</config>
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridSection.xml
index efc54c77c5f..e9181daa11f 100644
--- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridSection.xml
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminCustomerGridSection.xml
@@ -10,5 +10,6 @@
         xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
     <section name="AdminCustomerGridSection">
         <element name="customerGrid" type="text" selector="table[data-role='grid']"/>
+        <element name="firstRowEditLink" type="checkbox" selector="tr[data-repeat-index='0'] .action-menu-item" timeout="30"/>
     </section>
 </config>
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminEditCustomerInformationSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminEditCustomerInformationSection.xml
new file mode 100644
index 00000000000..164b45889a1
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminEditCustomerInformationSection.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ /**
+  * Copyright © Magento, Inc. All rights reserved.
+  * See COPYING.txt for license details.
+  */
+-->
+
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
+    <section name="AdminEditCustomerInformationSection">
+        <element name="orders" type="button" selector="#tab_orders_content" timeout="30"/>
+    </section>
+</config>
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminEditCustomerOrdersSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminEditCustomerOrdersSection.xml
new file mode 100644
index 00000000000..61d7ca95290
--- /dev/null
+++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Customer/Section/AdminEditCustomerOrdersSection.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ /**
+  * Copyright © Magento, Inc. All rights reserved.
+  * See COPYING.txt for license details.
+  */
+-->
+
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
+    <section name="AdminEditCustomerOrdersSection">
+        <element name="orderGrid" type="text" selector="#customer_orders_grid_table"/>
+    </section>
+</config>
-- 
GitLab