Skip to content

Commit 6ed1b42

Browse files
committed
MAGETWO-90727: Ordered Products Report Error for restricted scope admin
1 parent c59e602 commit 6ed1b42

17 files changed

+239
-7
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!--Login as any user-->
12+
<actionGroup name="AdminLoginAsAnyUser">
13+
<arguments>
14+
<argument name="login" type="string" defaultValue="{{_ENV.MAGENTO_ADMIN_USERNAME}}"/>
15+
<argument name="password" type="string" defaultValue="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/>
16+
</arguments>
17+
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/>
18+
<fillField userInput="{{login}}" selector="{{AdminLoginFormSection.username}}" stepKey="fillUsername"/>
19+
<fillField userInput="{{password}}" selector="{{AdminLoginFormSection.password}}" stepKey="fillPassword"/>
20+
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
21+
<closeAdminNotification stepKey="closeAdminNotification"/>
22+
</actionGroup>
23+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,23 @@
169169
<waitForPageLoad stepKey="waitForPageLoad"/>
170170
<dontSeeElement selector="{{AdminProductImagesSection.imageFile(image.filename)}}" stepKey="seeImage"/>
171171
</actionGroup>
172+
<actionGroup name="CreatedProductConnectToWebsite">
173+
<arguments>
174+
<argument name="website"/>
175+
<argument name="product"/>
176+
</arguments>
177+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductGridPage"/>
178+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
179+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
180+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
181+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
182+
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
183+
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="openProduct"/>
184+
<waitForPageLoad stepKey="waitForProductPage"/>
185+
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/>
186+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openWebsitesList"/>
187+
<click selector="{{ProductInWebsitesSection.website(website.name)}}" stepKey="selectWebsite"/>
188+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
189+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product." stepKey="seeSaveConfirmation"/>
190+
</actionGroup>
172191
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminCreateCustomerWithWebsiteAndStoreViewActionGroup">
11+
<arguments>
12+
<argument name="customer"/>
13+
<argument name="address"/>
14+
<argument name="websiteName" type="string"/>
15+
<argument name="storeViewName" type="string"/>
16+
</arguments>
17+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/>
18+
<click selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}" stepKey="addNewCustomer"/>
19+
<selectOption selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{websiteName}}" stepKey="selectWebSite"/>
20+
<fillField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customer.firstname}}" stepKey="fillFirstName"/>
21+
<fillField selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customer.lastname}}" stepKey="fillLastName"/>
22+
<fillField selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customer.email}}" stepKey="fillEmail"/>
23+
<selectOption selector="{{AdminCustomerAccountInformationSection.storeView}}" userInput="{{storeViewName}}" stepKey="selectStoreView"/>
24+
<scrollToTopOfPage stepKey="scrollToTopOfThePage"/>
25+
<click selector="{{AdminCustomerAccountInformationSection.addressesButton}}" stepKey="goToAddresses"/>
26+
<waitForPageLoad stepKey="waitForAddresses"/>
27+
<click selector="{{AdminCustomerEditAddressesSection.addNewAddress}}" stepKey="clickOnAddNewAddress"/>
28+
<waitForPageLoad stepKey="waitForAddressFields"/>
29+
<click selector="{{AdminCustomerEditAddressesSection.defaultBillingAddress}}" stepKey="tickBillingAddress"/>
30+
<click selector="{{AdminCustomerEditAddressesSection.defaultShippingAddress}}" stepKey="tickShippingAddress"/>
31+
<fillField selector="{{AdminCustomerEditAddressesSection.firstName}}" userInput="{{address.firstname}}" stepKey="fillFirstNameForAddress"/>
32+
<fillField selector="{{AdminCustomerEditAddressesSection.lastName}}" userInput="{{address.lastname}}" stepKey="fillLastNameForAddress"/>
33+
<fillField selector="{{AdminCustomerEditAddressesSection.streetAddress}}" userInput="{{address.street[0]}}" stepKey="fillStreetAddress"/>
34+
<fillField selector="{{AdminCustomerEditAddressesSection.city}}" userInput="{{address.city}}" stepKey="fillCity"/>
35+
<selectOption selector="{{AdminCustomerEditAddressesSection.country}}" userInput="{{address.country}}" stepKey="selectCountry"/>
36+
<selectOption selector="{{AdminCustomerEditAddressesSection.state}}" userInput="{{address.state}}" stepKey="selectState"/>
37+
<fillField selector="{{AdminCustomerEditAddressesSection.zip}}" userInput="{{address.postcode}}" stepKey="fillZip"/>
38+
<fillField selector="{{AdminCustomerEditAddressesSection.phoneNumber}}" userInput="{{address.telephone}}" stepKey="fillPhoneNumber"/>
39+
<click selector="{{AdminMainActionsSection.save}}" stepKey="save"/>
40+
<see userInput="You saved the customer." stepKey="seeSuccessMessage"/>
41+
</actionGroup>
42+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
<data key="default_billing">Yes</data>
8989
<data key="default_shipping">Yes</data>
9090
<requiredEntity type="region">RegionNY</requiredEntity>
91+
<data key="country">United States</data>
9192
</entity>
9293
<entity name="UK_Default_Address" type="address">
9394
<data key="firstname">Jane</data>

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountInformationSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<section name="AdminCustomerAccountInformationSection">
1010
<element name="accountInformationTitle" type="text" selector=".admin__page-nav-title"/>
1111
<element name="accountInformationButton" type="text" selector="//a/span[text()='Account Information']"/>
12+
<element name="addressesButton" type="select" selector="//a//span[contains(text(), 'Addresses')]"/>
1213
<element name="firstName" type="input" selector="input[name='customer[firstname]']"/>
1314
<element name="lastName" type="input" selector="input[name='customer[lastname]']"/>
1415
<element name="email" type="input" selector="input[name='customer[email]']"/>
Lines changed: 24 additions & 0 deletions
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminCustomerEditAddressesSection">
12+
<element name="addNewAddress" type="button" selector="//span[text()='Add New Addresses']"/>
13+
<element name="defaultBillingAddress" type="button" selector="//label[text()='Default Billing Address']"/>
14+
<element name="defaultShippingAddress" type="button" selector="//label[text()='Default Shipping Address']"/>
15+
<element name="firstName" type="button" selector="input[name*='address'][name*=firstname]"/>
16+
<element name="lastName" type="button" selector="input[name*='address'][name*=lastname]"/>
17+
<element name="streetAddress" type="button" selector="input[name*='address'][name*=street]"/>
18+
<element name="city" type="input" selector="input[name*='address'][name*=city]"/>
19+
<element name="country" type="select" selector="select[name*='address'][name*=country_id]"/>
20+
<element name="state" type="select" selector="select[name*=address][name*=region_id]"/>
21+
<element name="zip" type="input" selector="input[name*=address][name*=postcode]"/>
22+
<element name="phoneNumber" type="input" selector="input[name*=address][name*=telephone]"/>
23+
</section>
24+
</sections>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminReviewOrderActionGroup">
12+
<arguments>
13+
<argument name="productName" type="string"/>
14+
</arguments>
15+
<click selector="{{AdminMenuSection.reports}}" stepKey="openReports"/>
16+
<waitForPageLoad time="5" stepKey="waitForReports"/>
17+
<click selector="{{AdminMenuSection.ordered}}" stepKey="openOrdered"/>
18+
<waitForPageLoad time="5" stepKey="waitForOrdersPage"/>
19+
<click selector="{{AdminOrderedProductsSection.refresh}}" stepKey="refresh"/>
20+
<scrollTo selector="{{AdminOrderedProductsSection.total}}" stepKey="scrollTo"/>
21+
<see userInput="{{productName}}" stepKey="seeOrder"/>
22+
</actionGroup>
23+
</actionGroups>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
10+
<page name="AdminOrderedProductsPage" url="admin/reports/report_product/sold" module="Magento_Reports" area="admin">
11+
<section name="AdminOrderedProductsSection"/>
12+
</page>
13+
</pages>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminMenuSection">
12+
<element name="reports" type="button" selector="#menu-magento-reports-report"/>
13+
<element name="ordered" type="button" selector=".item-report-products-sold"/>
14+
</section>
15+
</sections>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminOrderedProductsSection">
12+
<element name="refresh" type="button" selector="button[title='Refresh']" timeout="30"/>
13+
<element name="total" type="text" selector="#gridProductsSold_table tfoot th.col-period"/>
14+
</section>
15+
</sections>

0 commit comments

Comments
 (0)