Skip to content

Commit

Permalink
[EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
 - merged latest code from mainline branch
  • Loading branch information
magento-engcom-team authored Feb 12, 2019
2 parents e8e44a9 + ae2090c commit f6ecf31
Show file tree
Hide file tree
Showing 25 changed files with 562 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminMainActionsSection">
<element name="save" type="button" selector="#save" timeout="30"/>
<element name="saveAndContinue" type="button" selector="button[id*=save_and_]" timeout="30"/>
<element name="delete" type="button" selector="#delete"/>
<element name="delete" type="button" selector="#delete" timeout="30"/>
<element name="add" type="button" selector="#add" timeout="30"/>
<element name="back" type="button" selector="#back" timeout="30"/>
<element name="saveAndContinue" type="button" selector="button[id*=save_and_]" timeout="30"/>
</section>
</sections>
9 changes: 6 additions & 3 deletions app/code/Magento/Catalog/Model/CategoryList.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;

/**
* Class for getting category list.
*/
class CategoryList implements CategoryListInterface
{
/**
Expand Down Expand Up @@ -64,7 +67,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getList(SearchCriteriaInterface $searchCriteria)
{
Expand All @@ -75,8 +78,8 @@ public function getList(SearchCriteriaInterface $searchCriteria)
$this->collectionProcessor->process($searchCriteria, $collection);

$items = [];
foreach ($collection->getAllIds() as $id) {
$items[] = $this->categoryRepository->get($id);
foreach ($collection->getItems() as $category) {
$items[] = $this->categoryRepository->get($category->getId());
}

/** @var CategorySearchResultsInterface $searchResult */
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,8 @@
<data key="quantity">1</data>
<requiredEntity type="product_extension_attribute">EavStock1</requiredEntity>
</entity>
<entity name="ApiSimpleWithQty100" extends="ApiSimpleOne">
<data key="quantity">100</data>
<requiredEntity type="product_extension_attribute">EavStock100</requiredEntity>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
<entity name="EavStock1" type="product_extension_attribute">
<requiredEntity type="stock_item">Qty_1</requiredEntity>
</entity>
<entity name="EavStock100" type="product_extension_attribute">
<requiredEntity type="stock_item">Qty_100</requiredEntity>
</entity>
</entities>
4 changes: 4 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/StockItemData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
<data key="qty">1</data>
<data key="is_in_stock">true</data>
</entity>
<entity name="Qty_100" type="stock_item">
<data key="qty">100</data>
<data key="is_in_stock">true</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ public function testGetList()
$categoryIdSecond = 2;

$categoryFirst = $this->getMockBuilder(Category::class)->disableOriginalConstructor()->getMock();
$categoryFirst->expects($this->atLeastOnce())->method('getId')->willReturn($categoryIdFirst);
$categorySecond = $this->getMockBuilder(Category::class)->disableOriginalConstructor()->getMock();
$categorySecond->expects($this->atLeastOnce())->method('getId')->willReturn($categoryIdSecond);

/** @var SearchCriteriaInterface|\PHPUnit_Framework_MockObject_MockObject $searchCriteria */
$searchCriteria = $this->createMock(SearchCriteriaInterface::class);

$collection = $this->getMockBuilder(Collection::class)->disableOriginalConstructor()->getMock();
$collection->expects($this->once())->method('getSize')->willReturn($totalCount);
$collection->expects($this->once())->method('getAllIds')->willReturn([$categoryIdFirst, $categoryIdSecond]);
$collection->expects($this->once())->method('getItems')->willReturn([$categoryFirst, $categorySecond]);

$this->collectionProcessorMock->expects($this->once())
->method('process')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?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="AdminRestrictedUserOnlyAccessCmsBlockTest">
<annotations>
<features value="Cms"/>
<stories value="Check access for restricted admin user"/>
<title value="Check: restricted admin with access only to CMS Block"/>
<description value="Check that the system shows information only in Blocks"/>
<severity value="MAJOR"/>
<testCaseId value="MC-13814"/>
<useCaseId value="MAGETWO-88612"/>
<group value="Cms"/>
</annotations>
<before>
<createData entity="restrictedWebUser" stepKey="createRestrictedAdmin"/>
<actionGroup ref="LoginToAdminActionGroup" stepKey="loginToBackend"/>
<actionGroup ref="AdminCreateUserRoleActionGroup" stepKey="createRestrictedAdminRole">
<argument name="roleName" value="{{RoleTest.roleName}}"/>
<argument name="resourceAccess" value="Custom"/>
<argument name="resource" value="Magento_Cms::block"/>
</actionGroup>
<actionGroup ref="AdminAssignUserRoleActionGroup" stepKey="assignAdminRole">
<argument name="user_restricted" value="$$createRestrictedAdmin$$"/>
<argument name="roleName" value="{{RoleTest.roleName}}"/>
</actionGroup>
<actionGroup ref="logout" stepKey="logOut"/>
</before>
<after>
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdminWithAllAccess"/>
<actionGroup ref="AdminDeleteUserRoleActionGroup" stepKey="deleteRestrictedRole">
<argument name="roleName" value="{{RoleTest.roleName}}"/>
</actionGroup>
<actionGroup ref="AdminDeleteUserActionGroup" stepKey="deleteRestrictedUser">
<argument name="user_restricted" value="$$createRestrictedAdmin$$"/>
</actionGroup>
<!--Log Out-->
<actionGroup ref="logout" stepKey="logOut"/>
</after>

<!--login as restricted user-->
<actionGroup ref="AdminLoginAsAnyUser" stepKey="logAsNewUser">
<argument name="login" value="$$createRestrictedAdmin.username$$"/>
<argument name="password" value="$$createRestrictedAdmin.password$$"/>
</actionGroup>

<!--Verify that The system shows information included in "Blocks"-->
<see userInput="Blocks" stepKey="seeBlocksPage"/>
<seeInCurrentUrl url="{{AdminCmsBlockGridPage.url}}" stepKey="assertUrl"/>
<!--Log Out-->
<actionGroup ref="logout" stepKey="logOut"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ public function testPrepareMetadata()
'config' => [
'editorConfig' => [
'enabled' => false
]
]
]
]
]
],
'componentType' => \Magento\Ui\Component\Container::NAME,
],
],
],
],
];

$this->assertEquals(
Expand Down
16 changes: 11 additions & 5 deletions app/code/Magento/Cms/Ui/Component/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Magento\Framework\AuthorizationInterface;
use Magento\Framework\View\Element\UiComponent\DataProvider\Reporting;

/**
* DataProvider for cms ui.
*/
class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider
{
/**
Expand Down Expand Up @@ -67,6 +70,8 @@ public function __construct(
}

/**
* Get authorization info.
*
* @deprecated 101.0.7
* @return AuthorizationInterface|mixed
*/
Expand Down Expand Up @@ -95,11 +100,12 @@ public function prepareMetadata()
'config' => [
'editorConfig' => [
'enabled' => false
]
]
]
]
]
],
'componentType' => \Magento\Ui\Component\Container::NAME,
],
],
],
],
];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?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="AdminCheckingProductQtyAfterOrderCancelTest">
<annotations>
<features value="ConfigurableProduct"/>
<stories value="Product quantity after order cancel"/>
<title value="Products quantity return after order cancel"/>
<description value="Checking product quantity after the order cancel"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-13790"/>
<group value="configurableProduct"/>
</annotations>
<before>
<!--Create category-->
<createData entity="ApiCategory" stepKey="createCategory"/>
<!--Create configurable product and add it to the category-->
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<!--Create attribute-->
<createData entity="productAttributeWithDropdownTwoOptions" stepKey="createConfigProductAttribute"/>
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<!--Add the attribute to default attribute set-->
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<!--Get the option of the attribute-->
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</getData>
<!--Create simple product and give it the attribute with option-->
<createData entity="ApiSimpleWithQty100" stepKey="createConfigChildProduct">
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption"/>
</createData>
<!--Create configurable product-->
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption"/>
</createData>
<!--Add simple product to the configurable product-->
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigChildProduct"/>
</createData>
<!--Create customer-->
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
<!--Login-->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<!--Clear grid filters-->
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrderGridPage"/>
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/>
<!--Delete entities-->
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
<deleteData createDataKey="createConfigChildProduct" stepKey="deleteConfigChildProduct"/>
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<!--Logout-->
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
<actionGroup ref="CustomerLogoutStorefrontActionGroup" stepKey="logoutFromStorefront"/>
</after>

<!--Go to Storefront as Customer-->
<actionGroup ref="CustomerLoginOnStorefront" stepKey="customerLogin">
<argument name="customer" value="$$createCustomer$$" />
</actionGroup>

<!--Go to the configurable product page on Storefront-->
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.sku$$)}}" stepKey="goToProductPage"/>
<!--Select option-->
<selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}" userInput="$$getConfigAttributeOption.label$$" stepKey="selectOption"/>
<!--Add product to the Shopping cart-->
<actionGroup ref="StorefrontAddProductToCartQuantityActionGroup" stepKey="addProductToCart">
<argument name="productName" value="$createConfigProduct.name$"/>
<argument name="quantity" value="4"/>
</actionGroup>

<!--Open Shopping cart-->
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCartFromMinicart"/>
<!--Place order-->
<actionGroup ref="PlaceOrderWithLoggedUserActionGroup" stepKey="placeOrder">
<argument name="shippingMethod" value="Flat Rate"/>
<argument name="paymentMethod" value="Check / Money order"/>
</actionGroup>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>

<!--Open order-->
<actionGroup ref="OpenOrderById" stepKey="openOrderById">
<argument name="orderId" value="{$grabOrderNumber}"/>
</actionGroup>

<!--Start create invoice-->
<actionGroup ref="StartCreateInvoiceFromOrderPage" stepKey="startCreateInvoice"/>
<!--Create partial invoice-->
<actionGroup ref="CreatePartialInvoice" stepKey="createPartialInvoice">
<argument name="productSku" value="$createConfigChildProduct.sku$"/>
<argument name="qtyToInvoice" value="1"/>
</actionGroup>
<!--Submit Invoice-->
<actionGroup ref="SubmitInvoice" stepKey="submitInvoice"/>
<!--Create Shipment-->
<actionGroup ref="StartCreateShipmentFromOrderPage" stepKey="startCreateShipment"/>
<fillField selector="{{AdminShipmentItemsSection.itemQtyToShip('1')}}" userInput="1" stepKey="changeItemQtyToShip"/>
<actionGroup ref="SubmitShipment" stepKey="submitShipment"/>

<!--Cancel order-->
<actionGroup ref="CancelProcessingOrder" stepKey="cancelOrder"/>
<!--Check quantities in "Items Ordered" table-->
<see selector="{{AdminOrderItemsOrderedSection.itemQty('1')}}" userInput="Invoiced 1" stepKey="seeInvoicedQuantity"/>
<see selector="{{AdminOrderItemsOrderedSection.itemQty('1')}}" userInput="Shipped 1" stepKey="seeShippedQuantity"/>
<see selector="{{AdminOrderItemsOrderedSection.itemQty('1')}}" userInput="Canceled 3" stepKey="seeCanceledQuantity"/>

<!--Go to catalog products page on Admin-->
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPage"/>
<actionGroup ref="filterProductGridBySku" stepKey="filterProductGrid">
<argument name="product" value="$$createConfigChildProduct$$"/>
</actionGroup>

<!--Check quantity of configurable child product-->
<see selector="{{AdminProductGridSection.productGridCell('1', 'Quantity')}}" userInput="99" stepKey="seeProductSkuInGrid"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
<argument name="emailTemplate" defaultValue="EmailTemplate"/>
</arguments>
<seeInCurrentUrl url="email_template/edit/id" stepKey="seeCreatedTemplateUrl"/>
<click selector="{{AdminMainActionsSection.delete}}" stepKey="clickDeleteTemplateButton"/>
<!--Do not change it to use element from AdminMainActionsSection. Refer to AdminEmailTemplateEditSection comment -->
<click selector="{{AdminEmailTemplateEditSection.delete}}" stepKey="clickDeleteTemplateButton"/>
<acceptPopup stepKey="acceptDeletingTemplatePopUp"/>
<see userInput="You deleted the email template." stepKey="seeSuccessfulMessage"/>
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickResetFilterButton"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
<element name="templateNameField" type="input" selector="#template_code"/>
<element name="templateSubjectField" type="input" selector="#template_subject"/>
<element name="previewTemplateButton" type="button" selector="#preview"/>
<!--Do not add time to this element. It call alert when clicking, so adding time will brake test-->
<element name="delete" type="button" selector="#delete"/>
</section>
</sections>
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="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="UpdateIndexerMode">
<arguments>
<argument name="indexerId" type="string"/>
<argument name="indexerMode" type="string" defaultValue="Update on Save"/>
</arguments>
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="amOnIndexManagementPage"/>
<checkOption selector="{{AdminIndexManagementSection.indexerCheckbox(indexerId)}}" stepKey="selectIndexer"/>
<selectOption selector="{{AdminIndexManagementSection.massActionSelect}}" userInput="{{indexerMode}}" stepKey="selectIndexerMode"/>
<click selector="{{AdminIndexManagementSection.massActionSubmit}}" stepKey="submitIndexerForm"/>
<see selector="{{AdminMessagesSection.success}}" userInput='1 indexer(s) are in "{{indexerMode}}" mode.' stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminIndexManagementPage" url="indexer/indexer/list" module="Magento_Indexer" area="admin">
<section name="AdminIndexManagementSection"/>
</page>
</pages>
Loading

0 comments on commit f6ecf31

Please sign in to comment.