Skip to content

Commit

Permalink
MAGETWO-92773: [GraphQL] Products cannot be fetched in parent/anchor …
Browse files Browse the repository at this point in the history
…category #89
  • Loading branch information
Alex Paliarush committed Jun 14, 2018
2 parents e3460a2 + 919dd8c commit 9058172
Show file tree
Hide file tree
Showing 49 changed files with 1,659 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\CatalogGraphQl\Model\Resolver\Products\SearchCriteria\CollectionProcessor\FilterProcessor;

use Magento\Catalog\Model\CategoryFactory;
Expand Down
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
<entity name="ApiBundleLink" type="bundle_link">
<var key="sku" entityKey="sku" entityType="product2"/>
<var key="option_id" entityKey="option_id" entityType="bundle_options"/>
<var key="sku" entityKey="sku" entityType="product"/>
<data key="qty">1</data>
<data key="is_default">1</data>
<data key="price">1.11</data>
<data key="price_type">1</data>
<data key="can_change_quantity">1</data>
</entity>
</entities>
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
<entity name="DropdownBundleOption" type="bundle_option">
<data key="title" unique="suffix">bundle-option-dropdown</data>
<data key="required">true</data>
<data key="type">dropdown</data>
<data key="position">1</data>
<var key="sku" entityKey="sku" entityType="product2"/>
</entity>
<entity name="AllBundleOptions" type="bundle_options">
<var key="sku" entityKey="sku" entityType="product"/>
</entity>
</entities>
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.
*/
-->
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
<entity name="CustomAttributeDynamicPrice" type="custom_attribute">
<data key="attribute_code">price_type</data>
<data key="value">0</data>
</entity>
<entity name="CustomAttributeFixPrice" type="custom_attribute">
<data key="attribute_code">price_type</data>
<data key="value">1</data>
</entity>
<entity name="CustomAttributePriceView" type="custom_attribute">
<data key="attribute_code">price_view</data>
<data key="value">1</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,18 @@
<data key="status">1</data>
<data key="urlKey" unique="suffix">bundleproduct</data>
</entity>
<entity name="ApiBundleProduct" type="product2">
<data key="name" unique="suffix">Api Bundle Product</data>
<data key="sku" unique="suffix">api-bundle-product</data>
<data key="type_id">bundle</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="status">1</data>
<data key="urlKey" unique="suffix">api-bundle-product</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute">ApiProductDescription</requiredEntity>
<requiredEntity type="custom_attribute">ApiProductShortDescription</requiredEntity>
<requiredEntity type="custom_attribute">CustomAttributeDynamicPrice</requiredEntity>
<requiredEntity type="custom_attribute">CustomAttributePriceView</requiredEntity>
</entity>
</entities>
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.
*/
-->

<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
<operation name="CreateBundleLink" dataType="bundle_link" type="create" auth="adminOauth" url="/V1/bundle-products/{sku}/links/{option_id}" method="POST">
<contentType>application/json</contentType>
<object dataType="bundle_link" key="linkedProduct">
<field key="sku">string</field>
<field key="option_id">integer</field>
<field key="qty">integer</field>
<field key="position">integer</field>
<field key="is_default">boolean</field>
<field key="price">number</field>
<field key="price_type">integer</field>
<field key="can_change_quantity">integer</field>
</object>
</operation>
</operations>
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.
*/
-->

<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
<operation name="CreateBundleOption" dataType="bundle_option" type="create" auth="adminOauth" url="/V1/bundle-products/options/add" method="POST">
<contentType>application/json</contentType>
<object dataType="bundle_option" key="option">
<field key="title">string</field>
<field key="required">boolean</field>
<field key="type">string</field>
<field key="position">integer</field>
<field key="sku">string</field>
</object>
</operation>
</operations>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
<operation name="GetAllBundleOptions" dataType="bundle_options" type="get" auth="adminOauth" url="/V1/bundle-products/{sku}/options/all" method="GET">
<contentType>application/json</contentType>
</operation>
</operations>
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,68 @@
<dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="dontSeeCategoryInTree"/>
</actionGroup>

<!-- Actions to fill out a new category from the product page-->
<!-- The action assumes that you are already on an admin product configuration page -->
<actionGroup name="FillNewProductCategory" >
<arguments>
<argument name="categoryName" defaultValue="Test Category" type="string"/>
<argument name="parentCategoryName" defaultValue="default" type="string"/>
</arguments>

<!-- Click on new Category -->
<click stepKey="clickNewCategory" selector="{{AdminProductCategoryCreationSection.newCategory}}"/>
<waitForPageLoad stepKey="waitForFieldSet"/>

<fillField stepKey="fillCategoryName" selector="{{AdminProductCategoryCreationSection.nameInput}}" userInput="{{categoryName}}"/>

<!-- Search and select a parent catagory for the product -->
<click stepKey="clickParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategory}}"/>
<waitForPageLoad stepKey="waitForDropDownVisible"/>
<fillField stepKey="searchForParent" userInput="{{parentCategoryName}}" selector="{{AdminProductCategoryCreationSection.parentSearch}}"/>
<waitForPageLoad stepKey="waitForFieldResults"/>
<click stepKey="clickParent" selector="{{AdminProductCategoryCreationSection.parentSearchResult}}"/>

<click stepKey="createCategory" selector="{{AdminProductCategoryCreationSection.createCategory}}"/>
<waitForPageLoad stepKey="waitForCategoryCreated"/>
</actionGroup>

<!-- Actions to delete the category last made -->
<actionGroup name="DeleteMostRecentCategory">

<amOnPage url="/{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/>

<waitForPageLoad stepKey="waitForCategoryPageLoad"/>

<click stepKey="goToCreateCategory" selector="{{AdminCategorySidebarTreeSection.lastCreatedCategory}}" />
<waitForPageLoad stepKey="waitForCreatedCategoryPageLoad"/>

<click stepKey="clickDeleteCategory" selector="{{AdminCategoryMainActionsSection.DeleteButton}}" />
<waitForPageLoad stepKey="waitForModalVisible"/>

<click stepKey="clickOkToDelete" selector="{{AdminCategoryModalSection.ok}}" />

<waitForPageLoad stepKey="waitForModalNotVisible"/>

</actionGroup>

<!-- Actions to check if a certain category is present on the page -->
<actionGroup name="CategoryPresent" >
<arguments>
<argument name="categoryName" defaultValue="Test Category" type="string"/>
</arguments>

<amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryAdminPage"/>
<waitForPageLoad stepKey="waitForCategoryAdminPageLoad"/>

<see userInput="{{categoryName}}" stepKey="assertCategoryOnAdminPage" selector="{{AdminCategorySidebarTreeSection.treeContainer}}"/>

<amOnPage url="/{{categoryName}}.html" stepKey="goToCustomerFrontPage"/>

<see userInput="{{categoryName}}" stepKey="assertCategoryNameOnStorefront" selector="{{StorefrontCategoryMainSection.CategoryTitle}}"/>

<waitForPageLoad stepKey="waitForCustomerCategoryPageLoad"/>
</actionGroup>

<!--Check that name field is required-->
<actionGroup name="CheckCategoryNameIsRequiredField">
<seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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="CreateCustomRadioOptions">

<!-- ActionGroup will add a single custom option to a product -->
<!-- You must already be on the product creation page -->
<arguments>
<argument name="customOptionName"/>
<argument name="productOption"/>
<argument name="productOption2"/>
</arguments>

<click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}"/>
<waitForPageLoad stepKey="waitForAddProductPageLoad"/>

<!-- Fill in the option and select the type of radio (once) -->
<fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{customOptionName}}"/>
<click stepKey="clickOptionTypeParent" selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}"/>
<waitForPageLoad stepKey="waitForDropdownOpen"/>
<click stepKey="clickOptionType" selector="{{AdminProductCustomizableOptionsSection.optionType('Radio Buttons')}}"/>

<!-- Add three radio options based on the parameter -->
<click stepKey="clickAddValue" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/>

<fillField stepKey="fillInValueTitle" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption.title}}"/>
<fillField stepKey="fillInValuePrice" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption.price}}"/>

<click stepKey="clickAddValue2" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/>

<fillField stepKey="fillInValueTitle2" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption2.title}}"/>
<fillField stepKey="fillInValuePrice2" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption2.price}}"/>


</actionGroup>

</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,29 @@
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">ApiProductNewsFromDate</requiredEntity>
</entity>
<entity name="GetProduct" type="product">
<var key="sku" entityKey="sku" entityType="product"/>
</entity>
<entity name="GetProduct2" type="product2">
<var key="sku" entityKey="sku" entityType="product2"/>
</entity>
<entity name="GetProduct3" type="product3">
<var key="sku" entityKey="sku" entityType="product3"/>
</entity>
<entity name="ApiSimplePrice1" type="product">
<data key="sku" unique="suffix">api-simple-product</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="name" unique="suffix">Api Simple Product</data>
<data key="price">1.00</data>
</entity>
<entity name="ApiSimplePrice100" type="product">
<data key="sku" unique="suffix">api-simple-product</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="name" unique="suffix">Api Simple Product</data>
<data key="price">100.00</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
<data key="price_type">fixed</data>
<data key="max_characters">0</data>
</entity>
<entity name="ProductOptionField2" type="product_option">
<var key="product_sku" entityType="product" entityKey="sku" />
<data key="title">OptionField2</data>
<data key="type">field</data>
<data key="is_require">true</data>
<data key="sort_order">1</data>
<data key="price">20</data>
<data key="price_type">fixed</data>
<data key="max_characters">0</data>
</entity>
<entity name="ProductOptionArea" type="product_option">
<var key="product_sku" entityType="product" entityKey="sku" />
<data key="title">OptionArea</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
</object>
<field key="saveOptions">boolean</field>
</operation>
<operation name="deleteProduct" dataType="product" type="delete" auth="adminOauth" url="/V1/products/{sku}" method="DELETE">
<operation name="DeleteProduct" dataType="product" type="delete" auth="adminOauth" url="/V1/products/{sku}" method="DELETE">
<contentType>application/json</contentType>
</operation>
<operation name="GetProduct" dataType="product" type="get" auth="adminOauth" url="/V1/products/{sku}" method="GET">
<contentType>application/json</contentType>
</operation>
<operation name="CreateProduct2" dataType="product2" type="create" auth="adminOauth" url="/V1/products" method="POST">
Expand Down Expand Up @@ -115,7 +118,43 @@
</object>
<field key="saveOptions">boolean</field>
</operation>
<operation name="deleteProduct2" dataType="product2" type="delete" auth="adminOauth" url="/V1/products/{sku}" method="DELETE">
<operation name="DeleteProduct2" dataType="product2" type="delete" auth="adminOauth" url="/V1/products/{sku}" method="DELETE">
<contentType>application/json</contentType>
</operation>
<operation name="GetProduct2" dataType="product2" type="get" auth="adminOauth" url="/V1/products/{sku}" method="GET">
<contentType>application/json</contentType>
</operation>
<!-- Data type product3 is to work around MQE-1035 -->
<operation name="CreateProduct3" dataType="product3" type="create" auth="adminOauth" url="/V1/products" method="POST">
<contentType>application/json</contentType>
<object dataType="product3" key="product">
<field key="sku">string</field>
<field key="name">string</field>
<field key="attribute_set_id">integer</field>
<field key="price">number</field>
<field key="status">integer</field>
<field key="visibility">integer</field>
<field key="type_id">string</field>
<field key="created_at">string</field>
<field key="updated_at">string</field>
<field key="weight">integer</field>
<field key="extension_attributes">product_extension_attribute</field>
<array key="product_links">
<value>product_link</value>
</array>
<array key="custom_attributes">
<value>custom_attribute_array</value>
</array>
<array key="options">
<value>product_option</value>
</array>
</object>
</operation>
<!-- Data type product3 is to work around MQE-1035 -->
<operation name="DeleteProduct3" dataType="product3" type="delete" auth="adminOauth" url="/V1/products/{sku}" method="DELETE">
<contentType>application/json</contentType>
</operation>
<operation name="GetProduct3" dataType="product3" type="get" auth="adminOauth" url="/V1/products/{sku}" method="GET">
<contentType>application/json</contentType>
</operation>
</operations>
Loading

0 comments on commit 9058172

Please sign in to comment.