From 73689a1dbe61349a1deb7145549df0a7acf6342f Mon Sep 17 00:00:00 2001 From: Roman Ganin Date: Fri, 4 May 2018 09:10:49 -0500 Subject: [PATCH 001/133] MAGETWO-90803: phpunit.xml files should be ignored by Magento/Test/Integrity/Xml/SchemaTest.php --- .../testsuite/Magento/Test/Integrity/Xml/SchemaTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php index 15d948b600ea2..da0aeb6f0648b 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Xml/SchemaTest.php @@ -106,7 +106,9 @@ private function _filterSpecialCases(&$files) '#etc/countries.xml$#', '#conf/schema.xml$#', '#layout/swagger_index_index.xml$#', - '#Doc/etc/doc/vars.xml$#' + '#Doc/etc/doc/vars.xml$#', + '#phpunit.xml$#', + '#etc/db_schema.xml$#' ]; foreach ($list as $pattern) { foreach ($files as $key => $value) { From ad18a33139915f6ab915532af29af00c4d652f6f Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Tue, 22 May 2018 13:11:59 -0500 Subject: [PATCH 002/133] MC-111: Admin should be able to add default video for simple products - Added mftf test --- .../AdminAddDefaultVideoSimpleProductTest.xml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml new file mode 100644 index 0000000000000..ffd1c257f3344 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml @@ -0,0 +1,55 @@ + + + + + + + + + + <description value="Admin should be able to add default product video for a Simple Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-111"/> + <group value="ProductVideo"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!-- Set product video Youtube api key configuration --> + <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig"/> + </before> + <after> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + <!-- Set product video default configuration --> + <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig"/> + </after> + + <!-- Create product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + <!-- Add product video --> + <actionGroup ref="addProductVideo" stepKey="addProductVideo"/> + <!-- Save product --> + <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + + <!-- Assert product video in admin product form --> + <actionGroup ref="assertProductVideoAdminProductPage" stepKey="assertProductVideoAdminProductPage"/> + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + <!-- Assert product video in storefront product page --> + <actionGroup ref="assertProductVideoStorefrontProductPage" stepKey="assertProductVideoStorefrontProductPage"/> + </test> +</tests> From 349fa762a639a82fae61feb965e14800c0f9d336 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Tue, 22 May 2018 13:12:54 -0500 Subject: [PATCH 003/133] MC-109: Admin should be able to add default video for virtual products - Added mftf test --- ...AdminAddDefaultVideoVirtualProductTest.xml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoVirtualProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoVirtualProductTest.xml new file mode 100644 index 0000000000000..ade62a4210140 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoVirtualProductTest.xml @@ -0,0 +1,34 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoVirtualProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> + <annotations> + <features value="ProductVideo"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to add default product video for a Virtual Product"/> + <description value="Admin should be able to add default product video for a Virtual Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-109"/> + <group value="ProductVideo"/> + </annotations> + + <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> + + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <argument name="product" value="defaultVirtualProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <argument name="product" value="defaultVirtualProduct"/> + </actionGroup> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <argument name="product" value="defaultVirtualProduct"/> + </actionGroup> + </test> +</tests> From caa39153ca834a5e989b1a1d162530b528fa7c80 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Tue, 22 May 2018 13:14:02 -0500 Subject: [PATCH 004/133] MC-206: Admin should be able to remove default video from simple products - Added mftf test --- ...minRemoveDefaultVideoSimpleProductTest.xml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml new file mode 100644 index 0000000000000..477c9feec24aa --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml @@ -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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoSimpleProductTest"> + <annotations> + <features value="ProductVideo"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to remove default product video from a Simple Product"/> + <description value="Admin should be able to remove default product video from a Simple Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-206"/> + <group value="ProductVideo"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!-- Set product video Youtube api key configuration --> + <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig"/> + </before> + <after> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + <!-- Set product video default configuration --> + <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig"/> + </after> + + <!-- Create product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + <!-- Add product video --> + <actionGroup ref="addProductVideo" stepKey="addProductVideo"/> + <!-- Save product --> + <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <!-- Remove product video --> + <actionGroup ref="removeProductVideo" stepKey="removeProductVideo"/> + <!-- Save product --> + <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + + <!-- Assert product video not in admin product form --> + <actionGroup ref="assertProductVideoNotInAdminProductPage" stepKey="assertProductVideoNotInAdminProductPage"/> + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + <!-- Assert product video not in storefront product page --> + <actionGroup ref="assertProductVideoNotInStorefrontProductPage" stepKey="assertProductVideoNotInStorefrontProductPage"/> + </test> +</tests> From a125c328011e65dccc7f612b53827a4889175f19 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Tue, 22 May 2018 13:14:35 -0500 Subject: [PATCH 005/133] MC-204: Admin should be able to remove default video from virtual products - Added mftf test --- ...inRemoveDefaultVideoVirtualProductTest.xml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoVirtualProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoVirtualProductTest.xml new file mode 100644 index 0000000000000..5dcee2b9f79c1 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoVirtualProductTest.xml @@ -0,0 +1,34 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoVirtualProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> + <annotations> + <features value="ProductVideo"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to remove default product video from a Virtual Product"/> + <description value="Admin should be able to remove default product video from a Virtual Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-204"/> + <group value="ProductVideo"/> + </annotations> + + <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> + + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <argument name="product" value="defaultVirtualProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <argument name="product" value="defaultVirtualProduct"/> + </actionGroup> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <argument name="product" value="defaultVirtualProduct"/> + </actionGroup> + </test> +</tests> From 0a4ce597551b161992f3507bad7b366c81d8e938 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Tue, 22 May 2018 13:16:01 -0500 Subject: [PATCH 006/133] MC-114: Admin should be able to add default video for downloadable products - Added mftf test --- ...AddDefaultVideoDownloadableProductTest.xml | 43 +++++++++++++++++ ...AddDefaultVideoDownloadableProductTest.xml | 46 +++++++++++++++++++ ...AddDefaultVideoDownloadableProductTest.xml | 30 ++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml new file mode 100644 index 0000000000000..3e1e1394e1fcb --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -0,0 +1,43 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoDownloadableProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="You should be able to add default video for a Downloadable Product"/> + <description value="You should be able to add default video for a Downloadable Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-114"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + </after> + + <!-- Base AdminAddDefaultVideoDownloadableProductTest --> + + <comment userInput="Create product in admin" stepKey="anchor0"/> + + <comment userInput="Add product video" stepKey="anchor1"/> + + <comment userInput="Add downloadable links" stepKey="anchor2"/> + + <comment userInput="Save product" stepKey="anchor3"/> + + <comment userInput="Assert product video in admin" stepKey="anchor4"/> + + <comment userInput="Assert product in storefront" stepKey="anchor5"/> + + <comment userInput="Assert product video in storefront" stepKey="anchor6"/> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml new file mode 100644 index 0000000000000..d70688f3c26ee --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -0,0 +1,46 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoDownloadableProductTest"> + <annotations> + <group value="Downloadable"/> + </annotations> + <!-- Create downloadable product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd" after="anchor0"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad" after="adminProductIndexPageAdd"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="adminProductIndexPageAdd"> + <argument name="product" value="DownloadableProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <argument name="product" value="DownloadableProduct"/> + </actionGroup> + + <!-- Add downloadable links --> + <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="anchor2"/> + <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkIsDownloadable" after="openDownloadableSection"/> + <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillDownloadableLinkTitle" after="checkIsDownloadable"/> + <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkLinksPurchasedSeparately" after="fillDownloadableLinkTitle"/> + <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillDownloadableSampleTitle" after="checkLinksPurchasedSeparately"/> + <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableLinkWithMaxDownloads" after="fillDownloadableSampleTitle"> + <argument name="link" value="downloadableLinkWithMaxDownloads"/> + </actionGroup> + <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableLink" after="addDownloadableLinkWithMaxDownloads"> + <argument name="link" value="downloadableLink"/> + </actionGroup> + + <!--Save Product--> + <actionGroup ref="saveProductForm" stepKey="saveDownloadableProduct" after="anchor3"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor5"> + <argument name="product" value="DownloadableProduct"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml new file mode 100644 index 0000000000000..ab87cab35e838 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoDownloadableProductTest"> + <before> + <!-- Set product video Youtube api key configuration --> + <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> + </before> + <after> + <!-- Set product video configuration to default --> + <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" after="amOnLogoutPage"/> + </after> + + <!-- Add product video --> + <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="anchor1"/> + + <!-- Assert product video in admin product form --> + <actionGroup ref="assertProductVideoAdminProductPage" stepKey="assertProductVideoAdminProductPage" after="anchor4"/> + + <!-- Assert product video in storefront product page --> + <actionGroup ref="assertProductVideoStorefrontProductPage" stepKey="assertProductVideoStorefrontProductPage" after="anchor6"/> + </test> +</tests> From bcd9e8d63e31e3df7744c014758c942e5d37c647 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Tue, 22 May 2018 13:16:44 -0500 Subject: [PATCH 007/133] MC-207: Admin should be able to remove default video from downloadable products - Added mftf test --- ...oveDefaultVideoDownloadableProductTest.xml | 47 ++++++++++++++++++ ...oveDefaultVideoDownloadableProductTest.xml | 49 +++++++++++++++++++ ...oveDefaultVideoDownloadableProductTest.xml | 33 +++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml new file mode 100644 index 0000000000000..7027e141ab3de --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -0,0 +1,47 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoDownloadableProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="You should be able to remove product video from a Downloadable Product."/> + <description value="You should be able to remove product video from a Downloadable Product."/> + <severity value="MAJOR"/> + <testCaseId value="MC-207"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + </after> + + <!-- Base AdminRemoveDefaultVideoDownloadableProductTest to be merged into --> + + <comment userInput="Create product in admin" stepKey="anchor0"/> + + <comment userInput="Add product video" stepKey="anchor1"/> + + <comment userInput="Add downloadable links" stepKey="anchor2"/> + + <comment userInput="Save product" stepKey="anchor3"/> + + <comment userInput="Remove product video" stepKey="anchor8"/> + + <comment userInput="Save product" stepKey="anchor9"/> + + <comment userInput="Assert product video not in admin" stepKey="anchor10"/> + + <comment userInput="Assert product in storefront" stepKey="anchor11"/> + + <comment userInput="Assert product video not in storefront" stepKey="anchor12"/> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml new file mode 100644 index 0000000000000..a04c544320422 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -0,0 +1,49 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoDownloadableProductTest"> + <annotations> + <group value="Downloadable"/> + </annotations> + <!-- Create downloadable product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd" after="anchor0"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad" after="adminProductIndexPageAdd"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="adminProductIndexPageAdd"> + <argument name="product" value="DownloadableProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <argument name="product" value="DownloadableProduct"/> + </actionGroup> + + <!-- Add downloadable links --> + <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="anchor2"/> + <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkIsDownloadable" after="openDownloadableSection"/> + <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillDownloadableLinkTitle" after="checkIsDownloadable"/> + <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkLinksPurchasedSeparately" after="fillDownloadableLinkTitle"/> + <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillDownloadableSampleTitle" after="checkLinksPurchasedSeparately"/> + <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableLinkWithMaxDownloads" after="fillDownloadableSampleTitle"> + <argument name="link" value="downloadableLinkWithMaxDownloads"/> + </actionGroup> + <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableLink" after="addDownloadableLinkWithMaxDownloads"> + <argument name="link" value="downloadableLink"/> + </actionGroup> + + <!--Save Product--> + <actionGroup ref="saveProductForm" stepKey="saveDownloadableProduct" after="anchor3"/> + + <!--Save Product--> + <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove" after="anchor9"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove" after="anchor11"> + <argument name="product" value="DownloadableProduct"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml new file mode 100644 index 0000000000000..b499ae5981591 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -0,0 +1,33 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoDownloadableProductTest"> + <before> + <!-- Set product video Youtube api key configuration --> + <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> + </before> + <after> + <!-- Set product video configuration to default --> + <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" after="amOnLogoutPage"/> + </after> + + <!-- Add product video --> + <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="anchor1"/> + + <!-- Remove product video from product --> + <actionGroup ref="removeProductVideo" stepKey="removeProductVideo" after="anchor8"/> + + <!-- Assert product video not in admin product form --> + <actionGroup ref="assertProductVideoNotInAdminProductPage" stepKey="assertProductVideoNotInAdminProductPage" after="anchor10"/> + + <!-- Assert product video not in storefront product page --> + <actionGroup ref="assertProductVideoNotInStorefrontProductPage" stepKey="assertProductVideoNotInStorefrontProductPage" after="anchor12"/> + </test> +</tests> From dc898139df0e664c820fa8abbef7ba235ca8ac19 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Wed, 23 May 2018 09:51:46 -0500 Subject: [PATCH 008/133] MC-110: Admin should be able to add default video for bundle products - Added mftf test --- .../AdminAddDefaultVideoBundleProductTest.xml | 55 +++++++++++++++++++ .../AdminAddDefaultVideoBundleProductTest.xml | 25 +++++++++ ...AddDefaultVideoDownloadableProductTest.xml | 5 +- ...oveDefaultVideoDownloadableProductTest.xml | 6 +- ...AddDefaultVideoDownloadableProductTest.xml | 23 ++++---- 5 files changed, 98 insertions(+), 16 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoBundleProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml new file mode 100644 index 0000000000000..8c505eeefc299 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml @@ -0,0 +1,55 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoBundleProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> + <before> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> + </before> + <after> + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> + </after> + + <!-- Create a bundle product --> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> + <argument name="product" value="BundleProduct"/> + </actionGroup> + <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <argument name="product" value="BundleProduct"/> + </actionGroup> + + <!-- Add two bundle items --> + <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="step0" after="anchor2"/> + <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="step1" after="step0"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="step2" after="step1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="step3" after="step2"/> + <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="step4" after="step3"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="step5" after="step4"/> + <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="step6" after="step5"/> + <waitForPageLoad stepKey="step7" after="step6"/> + <actionGroup ref="filterProductGridBySku" stepKey="step8" after="step7"> + <argument name="product" value="$$simpleProduct1$$"/> + </actionGroup> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="step9" after="step8"/> + <actionGroup ref="filterProductGridBySku" stepKey="step10" after="step9"> + <argument name="product" value="$$simpleProduct2$$"/> + </actionGroup> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="step11" after="step10"/> + <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="step12" after="step11"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="step13" after="step12"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="step14" after="step13"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor5"> + <argument name="product" value="BundleProduct"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoBundleProductTest.xml new file mode 100644 index 0000000000000..306e2b9684136 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoBundleProductTest.xml @@ -0,0 +1,25 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoBundleProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to add default video for a Bundle Product"/> + <description value="Admin should be able to add default video for a Bundle Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-110"/> + <group value="Catalog"/> + </annotations> + + <!-- Base AdminAddDefaultVideoDownloadableProductTest --> + + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml index 3e1e1394e1fcb..670f105b05525 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -12,10 +12,11 @@ <annotations> <features value="Catalog"/> <stories value="Add/remove images and videos for all product types and category"/> - <title value="You should be able to add default video for a Downloadable Product"/> - <description value="You should be able to add default video for a Downloadable Product"/> + <title value="Admin should be able to add default video for a Downloadable Product"/> + <description value="Admin should be able to add default video for a Downloadable Product"/> <severity value="MAJOR"/> <testCaseId value="MC-114"/> + <group value="Catalog"/> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml index 7027e141ab3de..49276e4c360d9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -12,8 +12,8 @@ <annotations> <features value="Catalog"/> <stories value="Add/remove images and videos for all product types and category"/> - <title value="You should be able to remove product video from a Downloadable Product."/> - <description value="You should be able to remove product video from a Downloadable Product."/> + <title value="Admin should be able to remove default video from a Downloadable Product"/> + <description value="Admin should be able to remove default video from a Downloadable Product"/> <severity value="MAJOR"/> <testCaseId value="MC-207"/> </annotations> @@ -24,7 +24,7 @@ <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> </after> - <!-- Base AdminRemoveDefaultVideoDownloadableProductTest to be merged into --> + <!-- Base AdminRemoveDefaultVideoDownloadableProductTest --> <comment userInput="Create product in admin" stepKey="anchor0"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml index d70688f3c26ee..7c9ac46d895f8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -13,9 +13,9 @@ <group value="Downloadable"/> </annotations> <!-- Create downloadable product --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd" after="anchor0"/> - <waitForPageLoad stepKey="waitForProductIndexPageLoad" after="adminProductIndexPageAdd"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="adminProductIndexPageAdd"> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage" after="anchor0"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad" after="goToAdminProductIndexPage"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm" after="goToCreateProductPage"> @@ -23,20 +23,21 @@ </actionGroup> <!-- Add downloadable links --> - <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="anchor2"/> - <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkIsDownloadable" after="openDownloadableSection"/> - <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillDownloadableLinkTitle" after="checkIsDownloadable"/> - <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkLinksPurchasedSeparately" after="fillDownloadableLinkTitle"/> - <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillDownloadableSampleTitle" after="checkLinksPurchasedSeparately"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableLinkWithMaxDownloads" after="fillDownloadableSampleTitle"> + <!-- Start specific product steps, generic stepKey so that it can be used for test extensions --> + <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="step0" after="anchor2"/> + <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="step1" after="step0"/> + <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="step2" after="step1"/> + <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="step3" after="step2"/> + <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="step4" after="step3"/> + <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="step5" after="step4"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableLink" after="addDownloadableLinkWithMaxDownloads"> + <actionGroup ref="addDownloadableProductLink" stepKey="step6" after="step5"> <argument name="link" value="downloadableLink"/> </actionGroup> <!--Save Product--> - <actionGroup ref="saveProductForm" stepKey="saveDownloadableProduct" after="anchor3"/> + <actionGroup ref="saveProductForm" stepKey="saveProduct" after="anchor3"/> <!-- Assert product in storefront product page --> <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor5"> From d58077eb8e581e454d0fe712b7876fe7432f8ee2 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Wed, 23 May 2018 10:36:19 -0500 Subject: [PATCH 009/133] MC-205: Admin should be able to remove default video from bundle products - Added mftf test --- .../AdminAddDefaultVideoBundleProductTest.xml | 3 + ...minRemoveDefaultVideoBundleProductTest.xml | 58 +++++++++++++++++++ ...AddDefaultVideoDownloadableProductTest.xml | 2 +- ...minRemoveDefaultVideoBundleProductTest.xml | 25 ++++++++ ...oveDefaultVideoDownloadableProductTest.xml | 3 +- ...oveDefaultVideoDownloadableProductTest.xml | 28 ++++----- 6 files changed, 104 insertions(+), 15 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoBundleProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml index 8c505eeefc299..e4eef93508159 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml @@ -9,6 +9,9 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdminAddDefaultVideoBundleProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> + <annotations> + <group value="Bundle"/> + </annotations> <before> <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml new file mode 100644 index 0000000000000..8813dedd6e8a7 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml @@ -0,0 +1,58 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoBundleProductTest" extends="AdminRemoveDefaultVideoDownloadableProductTest"> + <annotations> + <group value="Bundle"/> + </annotations> + <before> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> + </before> + <after> + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> + </after> + + <!-- Create a bundle product --> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> + <argument name="product" value="BundleProduct"/> + </actionGroup> + <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <argument name="product" value="BundleProduct"/> + </actionGroup> + + <!-- Add two bundle items --> + <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="step0" after="anchor2"/> + <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="step1" after="step0"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="step2" after="step1"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="step3" after="step2"/> + <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="step4" after="step3"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="step5" after="step4"/> + <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="step6" after="step5"/> + <waitForPageLoad stepKey="step7" after="step6"/> + <actionGroup ref="filterProductGridBySku" stepKey="step8" after="step7"> + <argument name="product" value="$$simpleProduct1$$"/> + </actionGroup> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="step9" after="step8"/> + <actionGroup ref="filterProductGridBySku" stepKey="step10" after="step9"> + <argument name="product" value="$$simpleProduct2$$"/> + </actionGroup> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="step11" after="step10"/> + <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="step12" after="step11"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="step13" after="step12"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="step14" after="step13"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor11"> + <argument name="product" value="BundleProduct"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml index 670f105b05525..d5148c729def1 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -31,7 +31,7 @@ <comment userInput="Add product video" stepKey="anchor1"/> - <comment userInput="Add downloadable links" stepKey="anchor2"/> + <comment userInput="Add additional product data" stepKey="anchor2"/> <comment userInput="Save product" stepKey="anchor3"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoBundleProductTest.xml new file mode 100644 index 0000000000000..eaaca5b3a71ba --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoBundleProductTest.xml @@ -0,0 +1,25 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoBundleProductTest" extends="AdminRemoveDefaultVideoDownloadableProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to remove default video from a Bundle Product"/> + <description value="Admin should be able to remove default video from a Bundle Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-205"/> + <group value="Catalog"/> + </annotations> + + <!-- Base AdminRemoveDefaultVideoBundleProductTest --> + + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml index 49276e4c360d9..8ee1ec62b07d3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -16,6 +16,7 @@ <description value="Admin should be able to remove default video from a Downloadable Product"/> <severity value="MAJOR"/> <testCaseId value="MC-207"/> + <group value="Catalog"/> </annotations> <before> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> @@ -30,7 +31,7 @@ <comment userInput="Add product video" stepKey="anchor1"/> - <comment userInput="Add downloadable links" stepKey="anchor2"/> + <comment userInput="Add additional product data" stepKey="anchor2"/> <comment userInput="Save product" stepKey="anchor3"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml index a04c544320422..2ac3a0221ea53 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -12,10 +12,11 @@ <annotations> <group value="Downloadable"/> </annotations> + <!-- Create downloadable product --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd" after="anchor0"/> - <waitForPageLoad stepKey="waitForProductIndexPageLoad" after="adminProductIndexPageAdd"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="adminProductIndexPageAdd"> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage" after="anchor0"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad" after="goToAdminProductIndexPage"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm" after="goToCreateProductPage"> @@ -23,26 +24,27 @@ </actionGroup> <!-- Add downloadable links --> - <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="anchor2"/> - <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkIsDownloadable" after="openDownloadableSection"/> - <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillDownloadableLinkTitle" after="checkIsDownloadable"/> - <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkLinksPurchasedSeparately" after="fillDownloadableLinkTitle"/> - <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillDownloadableSampleTitle" after="checkLinksPurchasedSeparately"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableLinkWithMaxDownloads" after="fillDownloadableSampleTitle"> + <!-- Start specific product steps, generic stepKey so that it can be used for test extensions --> + <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="step0" after="anchor2"/> + <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="step1" after="step0"/> + <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="step2" after="step1"/> + <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="step3" after="step2"/> + <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="step4" after="step3"/> + <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="step5" after="step4"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableLink" after="addDownloadableLinkWithMaxDownloads"> + <actionGroup ref="addDownloadableProductLink" stepKey="step6" after="step5"> <argument name="link" value="downloadableLink"/> </actionGroup> <!--Save Product--> - <actionGroup ref="saveProductForm" stepKey="saveDownloadableProduct" after="anchor3"/> + <actionGroup ref="saveProductForm" stepKey="saveProduct" after="anchor3"/> <!--Save Product--> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove" after="anchor9"/> + <actionGroup ref="saveProductForm" stepKey="saveProductAfterRemove" after="anchor9"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove" after="anchor11"> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor11"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </test> From ce4cc6f1012b3c327b6a8f60ed87fd41ddf2e8fb Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Wed, 23 May 2018 12:56:56 -0500 Subject: [PATCH 010/133] MC-108: Admin should be able to add default video for grouped products - Added mftf test --- ...AdminAddDefaultVideoGroupedProductTest.xml | 25 +++++++++ ...AdminAddDefaultVideoGroupedProductTest.xml | 53 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoGroupedProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoGroupedProductTest.xml new file mode 100644 index 0000000000000..b249a7b276751 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoGroupedProductTest.xml @@ -0,0 +1,25 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoGroupedProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to add default video for a Grouped Product"/> + <description value="Admin should be able to add default video for a Grouped Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-108"/> + <group value="Catalog"/> + </annotations> + + <!-- Base AdminAddDefaultVideoGroupedProductTest --> + + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml new file mode 100644 index 0000000000000..f6a099ee5134c --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml @@ -0,0 +1,53 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoGroupedProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> + <annotations> + <group value="GroupedProduct"/> + </annotations> + <before> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> + </before> + <after> + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> + </after> + + <!-- Create a grouped product --> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> + <argument name="product" value="GroupedProduct"/> + </actionGroup> + <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <argument name="product" value="GroupedProduct"/> + </actionGroup> + + <!-- Add two simple products to grouped product --> + <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="step0" after="anchor2"/> + <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="step1" after="step0"/> + <click selector="body" stepKey="step2" after="step1"/> + <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="step3" after="step2"/> + <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="step4" after="step3"/> + <actionGroup ref="filterProductGridBySku" stepKey="step5" after="step4"> + <argument name="product" value="$$simpleProduct1$$"/> + </actionGroup> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="step6" after="step5"/> + <actionGroup ref="filterProductGridBySku" stepKey="step7" after="step6"> + <argument name="product" value="$$simpleProduct2$$"/> + </actionGroup> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="step8" after="step7"/> + <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="step9" after="step8"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor5"> + <argument name="product" value="GroupedProduct"/> + </actionGroup> + </test> +</tests> From 24c76b1a5a7c749f17c33028de814cd0f16963bc Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Wed, 23 May 2018 13:44:49 -0500 Subject: [PATCH 011/133] MC-203: Admin should be able to remove default video for grouped products - Added mftf test --- ...inRemoveDefaultVideoGroupedProductTest.xml | 25 +++++++++ ...inRemoveDefaultVideoGroupedProductTest.xml | 53 +++++++++++++++++++ ...AddDefaultVideoDownloadableProductTest.xml | 3 ++ ...oveDefaultVideoDownloadableProductTest.xml | 3 ++ 4 files changed, 84 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoGroupedProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoGroupedProductTest.xml new file mode 100644 index 0000000000000..67c7244b976e2 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoGroupedProductTest.xml @@ -0,0 +1,25 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoGroupedProductTest" extends="AdminRemoveDefaultVideoDownloadableProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to remove default video from a Grouped Product"/> + <description value="Admin should be able to remove default video from a Grouped Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-203"/> + <group value="Catalog"/> + </annotations> + + <!-- Base AdminRemoveDefaultVideoGroupedProductTest --> + + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml new file mode 100644 index 0000000000000..fac9e492060f3 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml @@ -0,0 +1,53 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoGroupedProductTest" extends="AdminRemoveDefaultVideoDownloadableProductTest"> + <annotations> + <group value="GroupedProduct"/> + </annotations> + <before> + <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> + </before> + <after> + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> + </after> + + <!-- Create a grouped product --> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> + <argument name="product" value="GroupedProduct"/> + </actionGroup> + <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <argument name="product" value="GroupedProduct"/> + </actionGroup> + + <!-- Add two simple products to grouped product --> + <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="step0" after="anchor2"/> + <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="step1" after="step0"/> + <click selector="body" stepKey="step2" after="step1"/> + <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="step3" after="step2"/> + <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="step4" after="step3"/> + <actionGroup ref="filterProductGridBySku" stepKey="step5" after="step4"> + <argument name="product" value="$$simpleProduct1$$"/> + </actionGroup> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="step6" after="step5"/> + <actionGroup ref="filterProductGridBySku" stepKey="step7" after="step6"> + <argument name="product" value="$$simpleProduct2$$"/> + </actionGroup> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="step8" after="step7"/> + <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="step9" after="step8"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor11"> + <argument name="product" value="GroupedProduct"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml index ab87cab35e838..b7f33d6d05510 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -9,6 +9,9 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdminAddDefaultVideoDownloadableProductTest"> + <annotations> + <group value="ProductVideo"/> + </annotations> <before> <!-- Set product video Youtube api key configuration --> <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml index b499ae5981591..7e41414f1c4ce 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -9,6 +9,9 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdminRemoveDefaultVideoDownloadableProductTest"> + <annotations> + <group value="ProductVideo"/> + </annotations> <before> <!-- Set product video Youtube api key configuration --> <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> From 6140322f48626ed5dcb8bc29920dae8f034c0424 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Thu, 24 May 2018 09:33:43 -0500 Subject: [PATCH 012/133] MC-111: Admin should be able to add default video for simple product - updated mftf test --- .../AdminAddDefaultVideoSimpleProductTest.xml | 46 +++++++++++++++++++ .../AdminAddDefaultVideoSimpleProductTest.xml | 36 +++------------ 2 files changed, 53 insertions(+), 29 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoSimpleProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoSimpleProductTest.xml new file mode 100644 index 0000000000000..c0bc3bfc127f3 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoSimpleProductTest.xml @@ -0,0 +1,46 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminAddDefaultVideoSimpleProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to add default product video for a Simple Product"/> + <description value="Admin should be able to add default product video for a Simple Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-111"/> + <group value="Catalog"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + </after> + + <!-- Create product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + + <!-- Save product --> + <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml index ffd1c257f3344..bd7cc0cdf5b4a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml @@ -10,46 +10,24 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdminAddDefaultVideoSimpleProductTest"> <annotations> - <features value="ProductVideo"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default product video for a Simple Product"/> - <description value="Admin should be able to add default product video for a Simple Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-111"/> <group value="ProductVideo"/> </annotations> <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Set product video Youtube api key configuration --> - <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig"/> + <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> </before> <after> - <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> - <!-- Set product video default configuration --> - <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig"/> + <!-- Set product video configuration to default --> + <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" before="amOnLogoutPage"/> </after> - <!-- Create product --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> - <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo"/> - <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="fillMainProductForm"/> <!-- Assert product video in admin product form --> - <actionGroup ref="assertProductVideoAdminProductPage" stepKey="assertProductVideoAdminProductPage"/> - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> + <actionGroup ref="assertProductVideoAdminProductPage" stepKey="assertProductVideoAdminProductPage" after="saveProductForm"/> + <!-- Assert product video in storefront product page --> - <actionGroup ref="assertProductVideoStorefrontProductPage" stepKey="assertProductVideoStorefrontProductPage"/> + <actionGroup ref="assertProductVideoStorefrontProductPage" stepKey="assertProductVideoStorefrontProductPage" after="AssertProductInStorefrontProductPage"/> </test> </tests> From a32ec5577bfa911889b1537a016c8f4ca21d2cc4 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Thu, 24 May 2018 09:58:19 -0500 Subject: [PATCH 013/133] MC-206: Admin should be able to remove default video from simple product - updated mftf test --- ...minRemoveDefaultVideoSimpleProductTest.xml | 49 +++++++++++++++++++ ...minRemoveDefaultVideoSimpleProductTest.xml | 41 ++++------------ 2 files changed, 58 insertions(+), 32 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoSimpleProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoSimpleProductTest.xml new file mode 100644 index 0000000000000..6ec562322824d --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoSimpleProductTest.xml @@ -0,0 +1,49 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminRemoveDefaultVideoSimpleProductTest"> + <annotations> + <features value="Catalog"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to remove default product video from a Simple Product"/> + <description value="Admin should be able to remove default product video from a Simple Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-206"/> + <group value="Catalog"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + </after> + + <!-- Create product --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> + <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + + <!-- Save product --> + <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + + <!-- Save product --> + <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + + <!-- Assert product in storefront product page --> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> + <argument name="product" value="ApiSimpleProduct"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml index 477c9feec24aa..f5a7886fed45c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml @@ -10,50 +10,27 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdminRemoveDefaultVideoSimpleProductTest"> <annotations> - <features value="ProductVideo"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default product video from a Simple Product"/> - <description value="Admin should be able to remove default product video from a Simple Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-206"/> <group value="ProductVideo"/> </annotations> <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Set product video Youtube api key configuration --> - <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig"/> + <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> </before> <after> - <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> - <!-- Set product video default configuration --> - <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig"/> + <!-- Set product video configuration to default --> + <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" before="amOnLogoutPage"/> </after> - <!-- Create product --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> - <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo"/> - <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> + <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="fillMainProductForm"/> + <!-- Remove product video --> - <actionGroup ref="removeProductVideo" stepKey="removeProductVideo"/> - <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> + <actionGroup ref="removeProductVideo" stepKey="removeProductVideo" after="saveProductForm"/> <!-- Assert product video not in admin product form --> - <actionGroup ref="assertProductVideoNotInAdminProductPage" stepKey="assertProductVideoNotInAdminProductPage"/> - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> + <actionGroup ref="assertProductVideoNotInAdminProductPage" stepKey="assertProductVideoNotInAdminProductPage" after="saveProductFormAfterRemove"/> + <!-- Assert product video not in storefront product page --> - <actionGroup ref="assertProductVideoNotInStorefrontProductPage" stepKey="assertProductVideoNotInStorefrontProductPage"/> + <actionGroup ref="assertProductVideoNotInStorefrontProductPage" stepKey="assertProductVideoNotInStorefrontProductPage" after="AssertProductInStorefrontProductPage"/> </test> </tests> From 5ef3c3e1ad442630d53bf4911081dcc479c86a9d Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Thu, 24 May 2018 09:59:13 -0500 Subject: [PATCH 014/133] MC-209: Admin should be able to add default video for virtual product - updated mftf test --- .../Test/AdminAddDefaultVideoVirtualProductTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/{ProductVideo => Catalog}/Test/AdminAddDefaultVideoVirtualProductTest.xml (94%) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoVirtualProductTest.xml similarity index 94% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoVirtualProductTest.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoVirtualProductTest.xml index ade62a4210140..f48c352c5290a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoVirtualProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoVirtualProductTest.xml @@ -10,13 +10,13 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdminAddDefaultVideoVirtualProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> <annotations> - <features value="ProductVideo"/> + <features value="Catalog"/> <stories value="Add/remove images and videos for all product types and category"/> <title value="Admin should be able to add default product video for a Virtual Product"/> <description value="Admin should be able to add default product video for a Virtual Product"/> <severity value="MAJOR"/> <testCaseId value="MC-109"/> - <group value="ProductVideo"/> + <group value="Catalog"/> </annotations> <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> From 4cf830f6ccd570ca0c6c2a6898ef133aa7a6917f Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Thu, 24 May 2018 09:59:53 -0500 Subject: [PATCH 015/133] MC-204: Admin should be able to remove default video from virtual product - updated mftf test --- .../Test/AdminRemoveDefaultVideoVirtualProductTest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/{ProductVideo => Catalog}/Test/AdminRemoveDefaultVideoVirtualProductTest.xml (91%) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoVirtualProductTest.xml similarity index 91% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoVirtualProductTest.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoVirtualProductTest.xml index 5dcee2b9f79c1..e6d3978cad7bb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoVirtualProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoVirtualProductTest.xml @@ -10,13 +10,13 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdminRemoveDefaultVideoVirtualProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> <annotations> - <features value="ProductVideo"/> + <features value="Catalog"/> <stories value="Add/remove images and videos for all product types and category"/> <title value="Admin should be able to remove default product video from a Virtual Product"/> <description value="Admin should be able to remove default product video from a Virtual Product"/> <severity value="MAJOR"/> <testCaseId value="MC-204"/> - <group value="ProductVideo"/> + <group value="Catalog"/> </annotations> <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> @@ -27,7 +27,7 @@ <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPageAfterRemove"> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="defaultVirtualProduct"/> </actionGroup> </test> From 4106befdea14cc9b2f96c0f711472a996f08e040 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Thu, 24 May 2018 11:54:12 -0500 Subject: [PATCH 016/133] MC-114: Admin should be able to add default video for downloadable product MC-110: Admin should be able to add default video for bundle product MC-108: Admin should be able to add default video for grouped product MC-207: Admin should be able to remove default video from downloadable product MC-205: Admin should be able to remove default video from bundle product MC-203: Admin should be able to remove default video from grouped product - updated mftf test --- .../AdminAddDefaultVideoBundleProductTest.xml | 41 +++++++++------- ...minRemoveDefaultVideoBundleProductTest.xml | 41 +++++++++------- .../AdminAddDefaultVideoBundleProductTest.xml | 25 ---------- ...AddDefaultVideoDownloadableProductTest.xml | 44 ----------------- ...AdminAddDefaultVideoGroupedProductTest.xml | 25 ---------- ...minRemoveDefaultVideoBundleProductTest.xml | 25 ---------- ...oveDefaultVideoDownloadableProductTest.xml | 48 ------------------- ...inRemoveDefaultVideoGroupedProductTest.xml | 25 ---------- ...AddDefaultVideoDownloadableProductTest.xml | 38 ++++++++------- ...oveDefaultVideoDownloadableProductTest.xml | 40 ++++++++-------- ...AdminAddDefaultVideoGroupedProductTest.xml | 35 ++++++++------ ...inRemoveDefaultVideoGroupedProductTest.xml | 35 ++++++++------ ...AddDefaultVideoDownloadableProductTest.xml | 33 ------------- ...oveDefaultVideoDownloadableProductTest.xml | 36 -------------- 14 files changed, 129 insertions(+), 362 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoBundleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoGroupedProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoBundleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoGroupedProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml index e4eef93508159..516f47ef8ac56 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml @@ -8,8 +8,14 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoBundleProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> + <test name="AdminAddDefaultVideoBundleProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> <annotations> + <features value="Bundle"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to add default video for a Bundle Product"/> + <description value="Admin should be able to add default video for a Bundle Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-110"/> <group value="Bundle"/> </annotations> <before> @@ -22,6 +28,7 @@ </after> <!-- Create a bundle product --> + <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -30,28 +37,28 @@ </actionGroup> <!-- Add two bundle items --> - <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="step0" after="anchor2"/> - <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="step1" after="step0"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="step2" after="step1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="step3" after="step2"/> - <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="step4" after="step3"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="step5" after="step4"/> - <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="step6" after="step5"/> - <waitForPageLoad stepKey="step7" after="step6"/> - <actionGroup ref="filterProductGridBySku" stepKey="step8" after="step7"> + <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="openBundleSection" after="addProductVideo"/> + <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption" after="openBundleSection"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleTitle" after="clickAddOption"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillBundleTitle" after="waitForBundleTitle"/> + <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectOptionBundleTitle" after="fillBundleTitle"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProducts" after="selectOptionBundleTitle"/> + <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProducts" after="waitForAddProducts"/> + <waitForPageLoad stepKey="waitForPageLoad" after="clickAddProducts"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForPageLoad"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="step9" after="step8"/> - <actionGroup ref="filterProductGridBySku" stepKey="step10" after="step9"> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption1" after="filterProductGridBySku1"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2" after="checkOption1"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="step11" after="step10"/> - <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="step12" after="step11"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="step13" after="step12"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="step14" after="step13"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> + <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="addProducts" after="checkOption2"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty1" after="addProducts"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty2" before="saveProductForm"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor5"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml index 8813dedd6e8a7..51fa38ce421c8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml @@ -8,8 +8,14 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoBundleProductTest" extends="AdminRemoveDefaultVideoDownloadableProductTest"> + <test name="AdminRemoveDefaultVideoBundleProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> <annotations> + <features value="Bundle"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to remove default video from a Bundle Product"/> + <description value="Admin should be able to remove default video from a Bundle Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-205"/> <group value="Bundle"/> </annotations> <before> @@ -22,6 +28,7 @@ </after> <!-- Create a bundle product --> + <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> <argument name="product" value="BundleProduct"/> </actionGroup> @@ -30,28 +37,28 @@ </actionGroup> <!-- Add two bundle items --> - <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="step0" after="anchor2"/> - <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="step1" after="step0"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="step2" after="step1"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="step3" after="step2"/> - <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="step4" after="step3"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="step5" after="step4"/> - <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="step6" after="step5"/> - <waitForPageLoad stepKey="step7" after="step6"/> - <actionGroup ref="filterProductGridBySku" stepKey="step8" after="step7"> + <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="openBundleSection" after="addProductVideo"/> + <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption" after="openBundleSection"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleTitle" after="clickAddOption"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillBundleTitle" after="waitForBundleTitle"/> + <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectOptionBundleTitle" after="fillBundleTitle"/> + <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProducts" after="selectOptionBundleTitle"/> + <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProducts" after="waitForAddProducts"/> + <waitForPageLoad stepKey="waitForPageLoad" after="clickAddProducts"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForPageLoad"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="step9" after="step8"/> - <actionGroup ref="filterProductGridBySku" stepKey="step10" after="step9"> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption1" after="filterProductGridBySku1"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2" after="checkOption1"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="step11" after="step10"/> - <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="step12" after="step11"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="step13" after="step12"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="step14" after="step13"/> + <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> + <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="addProducts" after="checkOption2"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty1" after="addProducts"/> + <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty2" before="saveProductForm"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor11"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="BundleProduct"/> </actionGroup> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoBundleProductTest.xml deleted file mode 100644 index 306e2b9684136..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoBundleProductTest.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoBundleProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default video for a Bundle Product"/> - <description value="Admin should be able to add default video for a Bundle Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-110"/> - <group value="Catalog"/> - </annotations> - - <!-- Base AdminAddDefaultVideoDownloadableProductTest --> - - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml deleted file mode 100644 index d5148c729def1..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoDownloadableProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default video for a Downloadable Product"/> - <description value="Admin should be able to add default video for a Downloadable Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-114"/> - <group value="Catalog"/> - </annotations> - <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - </before> - <after> - <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> - </after> - - <!-- Base AdminAddDefaultVideoDownloadableProductTest --> - - <comment userInput="Create product in admin" stepKey="anchor0"/> - - <comment userInput="Add product video" stepKey="anchor1"/> - - <comment userInput="Add additional product data" stepKey="anchor2"/> - - <comment userInput="Save product" stepKey="anchor3"/> - - <comment userInput="Assert product video in admin" stepKey="anchor4"/> - - <comment userInput="Assert product in storefront" stepKey="anchor5"/> - - <comment userInput="Assert product video in storefront" stepKey="anchor6"/> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoGroupedProductTest.xml deleted file mode 100644 index b249a7b276751..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoGroupedProductTest.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoGroupedProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default video for a Grouped Product"/> - <description value="Admin should be able to add default video for a Grouped Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-108"/> - <group value="Catalog"/> - </annotations> - - <!-- Base AdminAddDefaultVideoGroupedProductTest --> - - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoBundleProductTest.xml deleted file mode 100644 index eaaca5b3a71ba..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoBundleProductTest.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoBundleProductTest" extends="AdminRemoveDefaultVideoDownloadableProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default video from a Bundle Product"/> - <description value="Admin should be able to remove default video from a Bundle Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-205"/> - <group value="Catalog"/> - </annotations> - - <!-- Base AdminRemoveDefaultVideoBundleProductTest --> - - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml deleted file mode 100644 index 8ee1ec62b07d3..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoDownloadableProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default video from a Downloadable Product"/> - <description value="Admin should be able to remove default video from a Downloadable Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-207"/> - <group value="Catalog"/> - </annotations> - <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - </before> - <after> - <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> - </after> - - <!-- Base AdminRemoveDefaultVideoDownloadableProductTest --> - - <comment userInput="Create product in admin" stepKey="anchor0"/> - - <comment userInput="Add product video" stepKey="anchor1"/> - - <comment userInput="Add additional product data" stepKey="anchor2"/> - - <comment userInput="Save product" stepKey="anchor3"/> - - <comment userInput="Remove product video" stepKey="anchor8"/> - - <comment userInput="Save product" stepKey="anchor9"/> - - <comment userInput="Assert product video not in admin" stepKey="anchor10"/> - - <comment userInput="Assert product in storefront" stepKey="anchor11"/> - - <comment userInput="Assert product video not in storefront" stepKey="anchor12"/> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoGroupedProductTest.xml deleted file mode 100644 index 67c7244b976e2..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoGroupedProductTest.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoGroupedProductTest" extends="AdminRemoveDefaultVideoDownloadableProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default video from a Grouped Product"/> - <description value="Admin should be able to remove default video from a Grouped Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-203"/> - <group value="Catalog"/> - </annotations> - - <!-- Base AdminRemoveDefaultVideoGroupedProductTest --> - - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml index 7c9ac46d895f8..63ed252360f00 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml @@ -8,39 +8,41 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoDownloadableProductTest"> + <test name="AdminAddDefaultVideoDownloadableProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> <annotations> + <features value="Downloadable"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to add default video for a Downloadable Product"/> + <description value="Admin should be able to add default video for a Downloadable Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-114"/> <group value="Downloadable"/> </annotations> - <!-- Create downloadable product --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage" after="anchor0"/> - <waitForPageLoad stepKey="waitForProductIndexPageLoad" after="goToAdminProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> + + <!-- Create a downloadable product --> + <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <!-- Add downloadable links --> - <!-- Start specific product steps, generic stepKey so that it can be used for test extensions --> - <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="step0" after="anchor2"/> - <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="step1" after="step0"/> - <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="step2" after="step1"/> - <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="step3" after="step2"/> - <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="step4" after="step3"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="step5" after="step4"> + <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="addProductVideo"/> + <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkOptionIsDownloadable" after="openDownloadableSection"/> + <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillLinkTitle" after="checkOptionIsDownloadable"/> + <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately" after="fillLinkTitle"/> + <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillSampleTitle" after="checkOptionPurchaseSeparately"/> + <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLinkWithMaxDownloads" after="fillSampleTitle"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="step6" after="step5"> + <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableProductLink" before="saveProductForm"> <argument name="link" value="downloadableLink"/> </actionGroup> - <!--Save Product--> - <actionGroup ref="saveProductForm" stepKey="saveProduct" after="anchor3"/> - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor5"> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml index 2ac3a0221ea53..2210dd009318a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml @@ -8,43 +8,41 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoDownloadableProductTest"> + <test name="AdminRemoveDefaultVideoDownloadableProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> <annotations> + <features value="Downloadable"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to remove default video from a Downloadable Product"/> + <description value="Admin should be able to remove default video from a Downloadable Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-207"/> <group value="Downloadable"/> </annotations> - <!-- Create downloadable product --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToAdminProductIndexPage" after="anchor0"/> - <waitForPageLoad stepKey="waitForProductIndexPageLoad" after="goToAdminProductIndexPage"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> + <!-- Create a downloadable product --> + <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> <argument name="product" value="DownloadableProduct"/> </actionGroup> <!-- Add downloadable links --> - <!-- Start specific product steps, generic stepKey so that it can be used for test extensions --> - <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="step0" after="anchor2"/> - <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="step1" after="step0"/> - <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="step2" after="step1"/> - <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="step3" after="step2"/> - <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="step4" after="step3"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="step5" after="step4"> + <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="addProductVideo"/> + <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkOptionIsDownloadable" after="openDownloadableSection"/> + <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillLinkTitle" after="checkOptionIsDownloadable"/> + <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately" after="fillLinkTitle"/> + <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillSampleTitle" after="checkOptionPurchaseSeparately"/> + <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLinkWithMaxDownloads" after="fillSampleTitle"> <argument name="link" value="downloadableLinkWithMaxDownloads"/> </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="step6" after="step5"> + <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableProductLink" before="saveProductForm"> <argument name="link" value="downloadableLink"/> </actionGroup> - <!--Save Product--> - <actionGroup ref="saveProductForm" stepKey="saveProduct" after="anchor3"/> - - <!--Save Product--> - <actionGroup ref="saveProductForm" stepKey="saveProductAfterRemove" after="anchor9"/> - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor11"> + <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="DownloadableProduct"/> </actionGroup> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml index f6a099ee5134c..d4c4655895051 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml @@ -8,8 +8,14 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoGroupedProductTest" extends="AdminAddDefaultVideoDownloadableProductTest"> + <test name="AdminAddDefaultVideoGroupedProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> <annotations> + <features value="GroupedProduct"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to add default video for a Grouped Product"/> + <description value="Admin should be able to add default video for a Grouped Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-108"/> <group value="GroupedProduct"/> </annotations> <before> @@ -22,31 +28,32 @@ </after> <!-- Create a grouped product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> + <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> <!-- Add two simple products to grouped product --> - <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="step0" after="anchor2"/> - <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="step1" after="step0"/> - <click selector="body" stepKey="step2" after="step1"/> - <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="step3" after="step2"/> - <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="step4" after="step3"/> - <actionGroup ref="filterProductGridBySku" stepKey="step5" after="step4"> + <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollTo" after="addProductVideo"/> + <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductSection" after="scrollTo"/> + <click selector="body" stepKey="clickBody" after="openGroupedProductSection"/> + <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup" after="clickBody"/> + <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForFilter" after="clickAddProductsToGroup"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForFilter"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> - <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="step6" after="step5"/> - <actionGroup ref="filterProductGridBySku" stepKey="step7" after="step6"> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption1" after="filterProductGridBySku1"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2" after="checkOption1"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> - <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="step8" after="step7"/> - <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="step9" after="step8"/> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> + <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="addSelectedProducts" before="saveProductForm"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor5"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml index fac9e492060f3..577fe9644a6fc 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml @@ -8,8 +8,14 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoGroupedProductTest" extends="AdminRemoveDefaultVideoDownloadableProductTest"> + <test name="AdminRemoveDefaultVideoGroupedProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> <annotations> + <features value="GroupedProduct"/> + <stories value="Add/remove images and videos for all product types and category"/> + <title value="Admin should be able to remove default video from a Grouped Product"/> + <description value="Admin should be able to remove default video from a Grouped Product"/> + <severity value="MAJOR"/> + <testCaseId value="MC-203"/> <group value="GroupedProduct"/> </annotations> <before> @@ -22,31 +28,32 @@ </after> <!-- Create a grouped product --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> + <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm" after="goToCreateProductPage"> + <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> <argument name="product" value="GroupedProduct"/> </actionGroup> <!-- Add two simple products to grouped product --> - <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="step0" after="anchor2"/> - <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="step1" after="step0"/> - <click selector="body" stepKey="step2" after="step1"/> - <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="step3" after="step2"/> - <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="step4" after="step3"/> - <actionGroup ref="filterProductGridBySku" stepKey="step5" after="step4"> + <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollTo" after="addProductVideo"/> + <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductSection" after="scrollTo"/> + <click selector="body" stepKey="clickBody" after="openGroupedProductSection"/> + <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup" after="clickBody"/> + <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForFilter" after="clickAddProductsToGroup"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForFilter"> <argument name="product" value="$$simpleProduct1$$"/> </actionGroup> - <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="step6" after="step5"/> - <actionGroup ref="filterProductGridBySku" stepKey="step7" after="step6"> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption1" after="filterProductGridBySku1"/> + <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2" after="checkOption1"> <argument name="product" value="$$simpleProduct2$$"/> </actionGroup> - <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="step8" after="step7"/> - <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="step9" after="step8"/> + <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> + <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="addSelectedProducts" before="saveProductForm"/> <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage" after="anchor11"> + <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> <argument name="product" value="GroupedProduct"/> </actionGroup> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml deleted file mode 100644 index b7f33d6d05510..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoDownloadableProductTest"> - <annotations> - <group value="ProductVideo"/> - </annotations> - <before> - <!-- Set product video Youtube api key configuration --> - <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> - </before> - <after> - <!-- Set product video configuration to default --> - <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" after="amOnLogoutPage"/> - </after> - - <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="anchor1"/> - - <!-- Assert product video in admin product form --> - <actionGroup ref="assertProductVideoAdminProductPage" stepKey="assertProductVideoAdminProductPage" after="anchor4"/> - - <!-- Assert product video in storefront product page --> - <actionGroup ref="assertProductVideoStorefrontProductPage" stepKey="assertProductVideoStorefrontProductPage" after="anchor6"/> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml deleted file mode 100644 index 7e41414f1c4ce..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoDownloadableProductTest"> - <annotations> - <group value="ProductVideo"/> - </annotations> - <before> - <!-- Set product video Youtube api key configuration --> - <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> - </before> - <after> - <!-- Set product video configuration to default --> - <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" after="amOnLogoutPage"/> - </after> - - <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="anchor1"/> - - <!-- Remove product video from product --> - <actionGroup ref="removeProductVideo" stepKey="removeProductVideo" after="anchor8"/> - - <!-- Assert product video not in admin product form --> - <actionGroup ref="assertProductVideoNotInAdminProductPage" stepKey="assertProductVideoNotInAdminProductPage" after="anchor10"/> - - <!-- Assert product video not in storefront product page --> - <actionGroup ref="assertProductVideoNotInStorefrontProductPage" stepKey="assertProductVideoNotInStorefrontProductPage" after="anchor12"/> - </test> -</tests> From c6134b0fa2a8fd6e6ea1f1a8ac7a550cece28cad Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Wed, 30 May 2018 15:05:09 -0500 Subject: [PATCH 017/133] MC-138: Guest customer should be able to advance search configurable product with product name MC-144: Guest customer should be able to advance search configurable product with product sku MC-237: Guest customer should be able to advance search configurable product with product description MC-240: Guest customer should be able to advance search configurable product with product short description - added mftf tests --- .../AdvanceCatalogSearchSimpleProductTest.xml | 22 ++ ...AdvanceCatalogSearchVirtualProductTest.xml | 51 ++++ .../AdvanceCatalogSearchConfigurableTest.xml | 64 +++++ ...AdvanceCatalogSearchSimpleProductTest.xml} | 63 +---- ...AdvanceCatalogSearchVirtualProductTest.xml | 80 ++++++ ...dvanceCatalogSearchVirtualProductsTest.xml | 141 --------- .../Data/ConfigurableProductData.xml | 13 + .../AdvanceCatalogSearchConfigurableTest.xml | 267 ++++++++++++++++++ 8 files changed, 502 insertions(+), 199 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchSimpleProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchConfigurableTest.xml rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/{AdvanceCatalogSearchSimpleProductsTest.xml => AdvanceCatalogSearchSimpleProductTest.xml} (60%) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductsTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchSimpleProductTest.xml new file mode 100644 index 0000000000000..aed0de5800153 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchSimpleProductTest.xml @@ -0,0 +1,22 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="createProductOne"/> + </before> + <after> + <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> + </after> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml new file mode 100644 index 0000000000000..775754143bc7e --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml @@ -0,0 +1,51 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchVirtualProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + </before> + </test> + <test name="AdvanceCatalogSearchVirtualProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + </before> + </test> + <test name="AdvanceCatalogSearchVirtualProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + </before> + </test> + <test name="AdvanceCatalogSearchVirtualProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + </before> + </test> + <test name="AdvanceCatalogSearchVirtualProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + </before> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchConfigurableTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchConfigurableTest.xml new file mode 100644 index 0000000000000..88b3ed0f9419d --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchConfigurableTest.xml @@ -0,0 +1,64 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchConfigurableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search configurable product with product name"/> + <description value="Guest customer should be able to advance search configurable product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-138"/> + <group value="CatalogSearch"/> + </annotations> + </test> + <test name="AdvanceCatalogSearchConfigurableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search configurable product with product sku"/> + <description value="Guest customer should be able to advance search configurable product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-144"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> + <argument name="sku" value="$$createProductOne.sku$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchConfigurableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search configurable product with product description"/> + <description value="Guest customer should be able to advance search configurable product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-237"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> + <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchConfigurableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search configurable product with product short description"/> + <description value="Guest customer should be able to advance search configurable product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-240"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> + <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductTest.xml similarity index 60% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductsTest.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductTest.xml index f52a86810842e..dbe225c24debc 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductsTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductTest.xml @@ -18,21 +18,15 @@ <testCaseId value="MC-132"/> <group value="CatalogSearch"/> </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameActionGroup" stepKey="search"> <argument name="name" value="$$createProductOne.name$$"/> </actionGroup> <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> + <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> - <test name="AdvanceCatalogSearchSimpleProductBySkuTest"> + <test name="AdvanceCatalogSearchSimpleProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> <features value="CatalogSearch"/> <stories value="Advanced Catalog Product Search for all product types"/> @@ -42,23 +36,11 @@ <testCaseId value="MC-133"/> <group value="CatalogSearch"/> </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> <argument name="sku" value="$$createProductOne.sku$$"/> </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> - - <test name="AdvanceCatalogSearchSimpleProductByDescriptionTest"> + <test name="AdvanceCatalogSearchSimpleProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> <features value="CatalogSearch"/> <stories value="Advanced Catalog Product Search for all product types"/> @@ -68,23 +50,11 @@ <testCaseId value="MC-134"/> <group value="CatalogSearch"/> </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> - - <test name="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> + <test name="AdvanceCatalogSearchSimpleProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> <features value="CatalogSearch"/> <stories value="Advanced Catalog Product Search for all product types"/> @@ -94,23 +64,11 @@ <testCaseId value="MC-135"/> <group value="CatalogSearch"/> </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> - - <test name="AdvanceCatalogSearchSimpleProductByPriceTest"> + <test name="AdvanceCatalogSearchSimpleProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> <features value="CatalogSearch"/> <stories value="Advanced Catalog Product Search for all product types"/> @@ -120,21 +78,10 @@ <testCaseId value="MC-136"/> <group value="CatalogSearch"/> </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> <argument name="name" value="$$createProductOne.name$$"/> <argument name="priceFrom" value="$$createProductOne.price$$"/> <argument name="priceTo" value="$$createProductOne.price$$"/> </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> </tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductTest.xml new file mode 100644 index 0000000000000..98bc7f01a6a00 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductTest.xml @@ -0,0 +1,80 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchVirtualProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product name"/> + <description value="Guest customer should be able to advance search virtual product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-137"/> + <group value="CatalogSearch"/> + </annotations> + </test> + <test name="AdvanceCatalogSearchVirtualProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product sku"/> + <description value="Guest customer should be able to advance search virtual product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-162"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> + <argument name="sku" value="$$createProductOne.sku$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchVirtualProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product description"/> + <description value="Guest customer should be able to advance search virtual product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-163"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> + <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchVirtualProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product short description"/> + <description value="Guest customer should be able to advance search virtual product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-164"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> + <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchVirtualProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product price"/> + <description value="Guest customer should be able to advance search virtual product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-165"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> + <argument name="name" value="$$createProductOne.name$$"/> + <argument name="priceFrom" value="$$createProductOne.price$$"/> + <argument name="priceTo" value="$$createProductOne.price$$"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductsTest.xml deleted file mode 100644 index 80b1b294fecd5..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductsTest.xml +++ /dev/null @@ -1,141 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchVirtualProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product name"/> - <description value="Guest customer should be able to advance search virtual product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-137"/> - <group value="CatalogSearch"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameActionGroup" stepKey="search"> - <argument name="name" value="$$createProductOne.name$$"/> - </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> - </test> - <test name="AdvanceCatalogSearchVirtualProductBySkuTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product sku"/> - <description value="Guest customer should be able to advance search virtual product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-162"/> - <group value="CatalogSearch"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> - <argument name="sku" value="$$createProductOne.sku$$"/> - </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> - </test> - - <test name="AdvanceCatalogSearchVirtualProductByDescriptionTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product description"/> - <description value="Guest customer should be able to advance search virtual product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-163"/> - <group value="CatalogSearch"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> - <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> - <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> - </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> - </test> - - <test name="AdvanceCatalogSearchVirtualProductByShortDescriptionTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product short description"/> - <description value="Guest customer should be able to advance search virtual product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-164"/> - <group value="CatalogSearch"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> - <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> - <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> - </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> - </test> - - <test name="AdvanceCatalogSearchVirtualProductByPriceTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product price"/> - <description value="Guest customer should be able to advance search virtual product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-165"/> - <group value="CatalogSearch"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> - </before> - <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> - </after> - - <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> - <argument name="name" value="$$createProductOne.name$$"/> - <argument name="priceFrom" value="$$createProductOne.price$$"/> - <argument name="priceTo" value="$$createProductOne.price$$"/> - </actionGroup> - <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> - <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/ConfigurableProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/ConfigurableProductData.xml index 0a2429fa8f9e5..70e758a51409d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/ConfigurableProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/ConfigurableProductData.xml @@ -34,6 +34,19 @@ <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> <requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity> </entity> + <entity name="ApiConfigurableProductWithDescription" type="product"> + <data key="sku" unique="suffix">api-configurable-product</data> + <data key="type_id">configurable</data> + <data key="attribute_set_id">4</data> + <data key="visibility">4</data> + <data key="name" unique="suffix">API Configurable Product</data> + <data key="urlKey" unique="suffix">api-configurable-product</data> + <data key="status">1</data> + <data key="quantity">100</data> + <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> + <requiredEntity type="custom_attribute_array">ApiProductDescription</requiredEntity> + <requiredEntity type="custom_attribute_array">ApiProductShortDescription</requiredEntity> + </entity> <entity name="ConfigurableProductAddChild" type="ConfigurableProductAddChild"> <var key="sku" entityKey="sku" entityType="product" /> <var key="childSku" entityKey="sku" entityType="product2"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml new file mode 100644 index 0000000000000..65760b5e72308 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml @@ -0,0 +1,267 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchConfigurableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> + + <createData entity="SimpleProduct" stepKey="simple1Handle" before="simple2Handle"> + <requiredEntity createDataKey="categoryHandle"/> + </createData> + + <createData entity="SimpleProduct" stepKey="simple2Handle" before="createProductOne"> + <requiredEntity createDataKey="categoryHandle"/> + </createData> + + <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> + <createData entity="ApiConfigurableProductWithDescription" stepKey="createProductOne"/> + + <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> + + <createData entity="productAttributeOption1" stepKey="productAttributeOption1Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + <createData entity="productAttributeOption2" stepKey="productAttributeOption2Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + + <createData entity="AddToDefaultSet" stepKey="addToAttributeSetHandle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption1Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getAttributeOption2Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </getData> + + <createData entity="SimpleOne" stepKey="childProductHandle1"> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption1Handle"/> + </createData> + <createData entity="SimpleOne" stepKey="childProductHandle2"> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption2Handle"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption1Handle"/> + <requiredEntity createDataKey="getAttributeOption2Handle"/> + </createData> + + <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="childProductHandle1"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="childProductHandle2"/> + </createData> + </before> + </test> + <test name="AdvanceCatalogSearchConfigurableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> + + <createData entity="SimpleProduct" stepKey="simple1Handle" before="simple2Handle"> + <requiredEntity createDataKey="categoryHandle"/> + </createData> + + <createData entity="SimpleProduct" stepKey="simple2Handle" before="createProductOne"> + <requiredEntity createDataKey="categoryHandle"/> + </createData> + + <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> + <createData entity="ApiConfigurableProductWithDescription" stepKey="createProductOne"/> + + <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> + + <createData entity="productAttributeOption1" stepKey="productAttributeOption1Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + <createData entity="productAttributeOption2" stepKey="productAttributeOption2Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + + <createData entity="AddToDefaultSet" stepKey="addToAttributeSetHandle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption1Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getAttributeOption2Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </getData> + + <createData entity="SimpleOne" stepKey="childProductHandle1"> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption1Handle"/> + </createData> + <createData entity="SimpleOne" stepKey="childProductHandle2"> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption2Handle"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption1Handle"/> + <requiredEntity createDataKey="getAttributeOption2Handle"/> + </createData> + + <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="childProductHandle1"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="childProductHandle2"/> + </createData> + </before> + </test> + <test name="AdvanceCatalogSearchConfigurableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> + + <createData entity="SimpleProduct" stepKey="simple1Handle" before="simple2Handle"> + <requiredEntity createDataKey="categoryHandle"/> + </createData> + + <createData entity="SimpleProduct" stepKey="simple2Handle" before="createProductOne"> + <requiredEntity createDataKey="categoryHandle"/> + </createData> + + <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> + <createData entity="ApiConfigurableProductWithDescription" stepKey="createProductOne"/> + + <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> + + <createData entity="productAttributeOption1" stepKey="productAttributeOption1Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + <createData entity="productAttributeOption2" stepKey="productAttributeOption2Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + + <createData entity="AddToDefaultSet" stepKey="addToAttributeSetHandle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption1Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getAttributeOption2Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </getData> + + <createData entity="SimpleOne" stepKey="childProductHandle1"> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption1Handle"/> + </createData> + <createData entity="SimpleOne" stepKey="childProductHandle2"> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption2Handle"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption1Handle"/> + <requiredEntity createDataKey="getAttributeOption2Handle"/> + </createData> + + <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="childProductHandle1"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="childProductHandle2"/> + </createData> + </before> + </test> + <test name="AdvanceCatalogSearchConfigurableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> + + <createData entity="SimpleProduct" stepKey="simple1Handle" before="simple2Handle"> + <requiredEntity createDataKey="categoryHandle"/> + </createData> + + <createData entity="SimpleProduct" stepKey="simple2Handle" before="createProductOne"> + <requiredEntity createDataKey="categoryHandle"/> + </createData> + + <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> + <createData entity="ApiConfigurableProductWithDescription" stepKey="createProductOne"/> + + <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> + + <createData entity="productAttributeOption1" stepKey="productAttributeOption1Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + <createData entity="productAttributeOption2" stepKey="productAttributeOption2Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + + <createData entity="AddToDefaultSet" stepKey="addToAttributeSetHandle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </createData> + + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption1Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getAttributeOption2Handle"> + <requiredEntity createDataKey="productAttributeHandle"/> + </getData> + + <createData entity="SimpleOne" stepKey="childProductHandle1"> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption1Handle"/> + </createData> + <createData entity="SimpleOne" stepKey="childProductHandle2"> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption2Handle"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="productAttributeHandle"/> + <requiredEntity createDataKey="getAttributeOption1Handle"/> + <requiredEntity createDataKey="getAttributeOption2Handle"/> + </createData> + + <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="childProductHandle1"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="childProductHandle2"/> + </createData> + </before> + </test> +</tests> From b7252a2ca55549d7076429dc18aad28170ca3c34 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Wed, 30 May 2018 15:49:07 -0500 Subject: [PATCH 018/133] MC-142: Guest customer should be able to advance search downloadable product with product name MC-252: Guest customer should be able to advance search downloadable product with product sku MC-243: Guest customer should be able to advance search downloadable product with product description MC-245: Guest customer should be able to advance search downloadable product with product short description MC-246: Guest customer should be able to advance search downloadable product with product price - added mftf tests --- ...ceCatalogSearchDownloadableProductTest.xml | 80 +++++++++++++++++ .../Downloadable/Data/LinkData.xml | 9 ++ .../Downloadable/Data/ProductData.xml | 15 ++++ .../Metadata/downloadable_link-meta.xml | 31 +++++++ .../Metadata/link_file_content-meta.xml | 15 ++++ .../Metadata/sample_file_content-meta.xml | 15 ++++ ...ceCatalogSearchDownloadableProductTest.xml | 86 +++++++++++++++++++ 7 files changed, 251 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchDownloadableProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/downloadable_link-meta.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/link_file_content-meta.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/sample_file_content-meta.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchDownloadableProductTest.xml new file mode 100644 index 0000000000000..bfb96dd23f06b --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchDownloadableProductTest.xml @@ -0,0 +1,80 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchDownloadableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product name"/> + <description value="Guest customer should be able to advance search Downloadable product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-142"/> + <group value="CatalogSearch"/> + </annotations> + </test> + <test name="AdvanceCatalogSearchDownloadableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product sku"/> + <description value="Guest customer should be able to advance search Downloadable product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-252"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> + <argument name="sku" value="$$createProductOne.sku$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchDownloadableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product description"/> + <description value="Guest customer should be able to advance search Downloadable product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-243"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> + <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchDownloadableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product short description"/> + <description value="Guest customer should be able to advance search Downloadable product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-245"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> + <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchDownloadableByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product price"/> + <description value="Guest customer should be able to advance search Downloadable product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-246"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> + <argument name="name" value="$$createProductOne.name$$"/> + <argument name="priceFrom" value="$$createProductOne.price$$"/> + <argument name="priceTo" value="$$createProductOne.price$$"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/LinkData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/LinkData.xml index 6276f340f85a6..5099255b3a1f7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/LinkData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/LinkData.xml @@ -41,4 +41,13 @@ <data key="file_type">URL</data> <data key="file">https://static.magento.com/sites/all/themes/mag_redesign/images/magento-logo.svg</data> </entity> + <entity name="ApiDownloadableLink" type="downloadable_link"> + <data key="title" unique="suffix">Api Downloadable Link</data> + <data key="price">2.00</data> + <data key="link_type">url</data> + <data key="shareable">No</data> + <data key="number_of_downloads">1000</data> + <data key="sort_order">0</data> + <data key="link_file">https://static.magento.com/sites/all/themes/mag_redesign/images/magento-logo.svg</data> + </entity> </entities> \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/ProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/ProductData.xml index 427f2577a8ab9..f71ebd481a97d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/ProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/ProductData.xml @@ -19,4 +19,19 @@ <data key="status">1</data> <data key="urlKey" unique="suffix">downloadableproduct</data> </entity> + <entity name="ApiDownloadableProduct" type="product"> + <data key="sku" unique="suffix">api-downloadable-product</data> + <data key="type_id">downloadable</data> + <data key="attribute_set_id">4</data> + <data key="visibility">4</data> + <data key="name" unique="suffix">Api Downloadable Product</data> + <data key="price">123.00</data> + <data key="urlKey" unique="suffix">api-downloadable-product</data> + <data key="status">1</data> + <data key="quantity">100</data> + <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> + <requiredEntity type="custom_attribute_array">ApiProductDescription</requiredEntity> + <requiredEntity type="custom_attribute_array">ApiProductShortDescription</requiredEntity> + <requiredEntity type="downloadable_link">apiDownloadableLink</requiredEntity> + </entity> </entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/downloadable_link-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/downloadable_link-meta.xml new file mode 100644 index 0000000000000..dc86c4e8d7957 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/downloadable_link-meta.xml @@ -0,0 +1,31 @@ +<?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="CreateDownloadableLink" dataType="downloadable_link" type="create" auth="adminOauth" url="/V1/products/{sku}/downloadable-links" method="POST"> + <contentType>application/json</contentType> + <object dataType="downloadable_link" key="link"> + <field key="title">string</field> + <field key="sort_order">integer</field> + <field key="is_shareable">integer</field> + <field key="price">number</field> + <field key="number_of_downloads">integer</field> + <field key="link_type">string</field> + <field key="link_file">string</field> + <field key="link_file_content">link_file_content</field> + <field key="file_data">string</field> + <field key="link_url">string</field> + <field key="sample_type">string</field> + <field key="sample_file">string</field> + <field key="sample_file_content">sample_file_content</field> + <field key="sample_url">string</field> + </object> + <field key="isGlobalScopeContent">boolean</field> + </operation> +</operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/link_file_content-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/link_file_content-meta.xml new file mode 100644 index 0000000000000..72f643e06800d --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/link_file_content-meta.xml @@ -0,0 +1,15 @@ +<?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="CreateLinkFileContent" dataType="link_file_content" type="create"> + <field key="file_data">string</field> + <field key="name">string</field> + </operation> +</operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/sample_file_content-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/sample_file_content-meta.xml new file mode 100644 index 0000000000000..144ce67bb25bb --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Metadata/sample_file_content-meta.xml @@ -0,0 +1,15 @@ +<?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="CreateSampleFileContent" dataType="sample_file_content" type="create"> + <field key="file_data">string</field> + <field key="name">string</field> + </operation> +</operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml new file mode 100644 index 0000000000000..ef8fcf66e92de --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml @@ -0,0 +1,86 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchDownloadableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <!-- Uncomment after bug MQE-1023 is fixed --> + <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> + <requiredEntity createDataKey="createProductOne"/> + </createData--> + </before> + </test> + <test name="AdvanceCatalogSearchDownloadableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <!-- Uncomment after bug MQE-1023 is fixed --> + <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> + <requiredEntity createDataKey="createProductOne"/> + </createData--> + </before> + </test> + <test name="AdvanceCatalogSearchDownloadableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <!-- Uncomment after bug MQE-1023 is fixed --> + <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> + <requiredEntity createDataKey="createProductOne"/> + </createData--> + </before> + </test> + <test name="AdvanceCatalogSearchDownloadableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <!-- Uncomment after bug MQE-1023 is fixed --> + <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> + <requiredEntity createDataKey="createProductOne"/> + </createData--> + </before> + </test> + <test name="AdvanceCatalogSearchDownloadableByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <!-- Uncomment after bug MQE-1023 is fixed --> + <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> + <requiredEntity createDataKey="createProductOne"/> + </createData--> + </before> + </test> +</tests> From 9a68fbd1578d30a37c6b41d48f3e0705af139c5b Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Thu, 31 May 2018 13:07:09 +0300 Subject: [PATCH 019/133] MAGETWO-90739: Out of stock options for configurable products still show up in search and layered navigation if Elasticsearch is enabled --- .../Api/Data/StockStatusInterface.php | 8 + .../CatalogInventory/Model/Stock/Status.php | 8 - .../Magento/Elasticsearch/Model/Config.php | 13 +- .../Plugin/DependencyUpdaterPlugin.php | 85 ++++++++ .../Plugin/StockedProductsFilterPlugin.php | 94 ++++++++ .../Plugin/DependencyUpdaterPluginTest.php | 84 ++++++++ .../StockedProductsFilterPluginTest.php | 131 +++++++++++ app/code/Magento/Elasticsearch/composer.json | 1 + app/code/Magento/Elasticsearch/etc/di.xml | 6 + .../Magento/Elasticsearch/etc/indexer.xml | 14 ++ .../Model/Client/ElasticsearchTest.php | 2 +- .../Model/Indexer/IndexHandlerTest.php | 204 ++++++++---------- .../_files/configurable_attribute.php | 63 ++++++ .../configurable_attribute_rollback.php | 29 +++ .../_files/configurable_products.php | 4 +- .../_files/configurable_products_rollback.php | 2 +- .../Magento/Elasticsearch/_files/indexer.php | 8 +- .../Magento/Elasticsearch/_files/requests.xml | 5 + .../Search/Adapter/Mysql/AdapterTest.php | 11 + .../Search/_files/product_configurable.php | 2 - .../Framework/Search/_files/requests.xml | 5 + .../Search/_files/search_weight_products.php | 10 - 22 files changed, 645 insertions(+), 144 deletions(-) create mode 100644 app/code/Magento/Elasticsearch/Model/Indexer/Plugin/DependencyUpdaterPlugin.php create mode 100644 app/code/Magento/Elasticsearch/Model/Indexer/Plugin/StockedProductsFilterPlugin.php create mode 100644 app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/DependencyUpdaterPluginTest.php create mode 100644 app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/StockedProductsFilterPluginTest.php create mode 100644 app/code/Magento/Elasticsearch/etc/indexer.xml create mode 100644 dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute.php create mode 100644 dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute_rollback.php diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockStatusInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockStatusInterface.php index 83defa64df250..c9ae6a96a3671 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockStatusInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockStatusInterface.php @@ -14,6 +14,14 @@ */ interface StockStatusInterface extends ExtensibleDataInterface { + /**#@+ + * Stock Status values. + */ + const STATUS_OUT_OF_STOCK = 0; + + const STATUS_IN_STOCK = 1; + /**#@-*/ + /**#@+ * Stock status object data keys */ diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Stock/Status.php index 9a56c8e8804ec..899056d8f0835 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Status.php @@ -17,14 +17,6 @@ */ class Status extends AbstractExtensibleModel implements StockStatusInterface { - /**#@+ - * Stock Status values - */ - const STATUS_OUT_OF_STOCK = 0; - - const STATUS_IN_STOCK = 1; - /**#@-*/ - /**#@+ * Field name */ diff --git a/app/code/Magento/Elasticsearch/Model/Config.php b/app/code/Magento/Elasticsearch/Model/Config.php index 93e715f928047..6f4e54e96fb9b 100644 --- a/app/code/Magento/Elasticsearch/Model/Config.php +++ b/app/code/Magento/Elasticsearch/Model/Config.php @@ -6,6 +6,7 @@ namespace Magento\Elasticsearch\Model; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Search\Model\EngineResolver; use Magento\Store\Model\ScopeInterface; use Magento\AdvancedSearch\Model\Client\ClientOptionsInterface; use Magento\AdvancedSearch\Model\Client\ClientResolver; @@ -58,17 +59,19 @@ class Config implements ClientOptionsInterface * Constructor * * @param ScopeConfigInterface $scopeConfig - * @param ClientResolver $clientResolver - * @param string $prefix + * @param ClientResolver|null $clientResolver + * @param EngineResolver|null $engineResolver + * @param string|null $prefix */ public function __construct( ScopeConfigInterface $scopeConfig, ClientResolver $clientResolver = null, + EngineResolver $engineResolver = null, $prefix = null ) { $this->scopeConfig = $scopeConfig; - $this->clientResolver = $clientResolver ?: - ObjectManager::getInstance()->get(ClientResolver::class); + $this->clientResolver = $clientResolver ?: ObjectManager::getInstance()->get(ClientResolver::class); + $this->engineResolver = $engineResolver ?: ObjectManager::getInstance()->get(EngineResolver::class); $this->prefix = $prefix ?: $this->clientResolver->getCurrentEngine(); } @@ -126,7 +129,7 @@ public function getSearchConfigData($field, $storeId = null) */ public function isElasticsearchEnabled() { - return $this->getSearchConfigData('engine') == self::ENGINE_NAME; + return $this->engineResolver->getCurrentSearchEngine() === self::ENGINE_NAME; } /** diff --git a/app/code/Magento/Elasticsearch/Model/Indexer/Plugin/DependencyUpdaterPlugin.php b/app/code/Magento/Elasticsearch/Model/Indexer/Plugin/DependencyUpdaterPlugin.php new file mode 100644 index 0000000000000..f1b153c98b2af --- /dev/null +++ b/app/code/Magento/Elasticsearch/Model/Indexer/Plugin/DependencyUpdaterPlugin.php @@ -0,0 +1,85 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch\Model\Indexer\Plugin; + +use Magento\Elasticsearch\Model\Config; +use Magento\Framework\Indexer\Config\DependencyInfoProvider as Provider; +use Magento\CatalogSearch\Model\Indexer\Fulltext as CatalogSearchFulltextIndexer; +use Magento\CatalogInventory\Model\Indexer\Stock\Processor as CatalogInventoryStockIndexer; + +/** + * Plugin for maintenance catalog search index dependency on stock index. + * If elasticsearch is used as search engine catalog search index becomes dependent on stock index. Elasticsearch + * module declares this dependence. But in case when elasticsearch module is enabled and elasticsearch engine isn`t + * used as search engine other search engines don`t need this dependency. + * This plugin remove catalog search index dependency on stock index when elasticsearch isn`t used as search engine + * except full reindexing. During full reindexing this dependency doesn`t make overhead. + */ +class DependencyUpdaterPlugin +{ + /** + * @var Config + */ + private $config; + + /** + * @param Config $config + */ + public function __construct(Config $config) + { + $this->config = $config; + } + + /** + * Remove index dependency, if it needed, on run reindexing by specifics indexes. + * + * @param Provider $provider + * @param array $dependencies + * @param string $indexerId + * @return array + * @see \Magento\Indexer\Console\Command\IndexerReindexCommand::getIndexers() + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterGetIndexerIdsToRunBefore(Provider $provider, array $dependencies, string $indexerId): array + { + if ($this->isFilteringNeeded($indexerId, CatalogSearchFulltextIndexer::INDEXER_ID)) { + $dependencies = array_diff($dependencies, [CatalogInventoryStockIndexer::INDEXER_ID]); + } + + return $dependencies; + } + + /** + * Remove index dependency, if it needed, on reindex triggers. + * + * @param Provider $provider + * @param array $dependencies + * @param string $indexerId + * @return array + * @see \Magento\Indexer\Model\Indexer\DependencyDecorator + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterGetIndexerIdsToRunAfter(Provider $provider, array $dependencies, string $indexerId): array + { + if ($this->isFilteringNeeded($indexerId, CatalogInventoryStockIndexer::INDEXER_ID)) { + $dependencies = array_diff($dependencies, [CatalogSearchFulltextIndexer::INDEXER_ID]); + } + + return $dependencies; + } + + /** + * @param string $currentIndexerId + * @param string $targetIndexerId + * @return bool + */ + private function isFilteringNeeded(string $currentIndexerId, string $targetIndexerId): bool + { + return (!$this->config->isElasticsearchEnabled() && $targetIndexerId === $currentIndexerId); + } +} diff --git a/app/code/Magento/Elasticsearch/Model/Indexer/Plugin/StockedProductsFilterPlugin.php b/app/code/Magento/Elasticsearch/Model/Indexer/Plugin/StockedProductsFilterPlugin.php new file mode 100644 index 0000000000000..ec18b955a2917 --- /dev/null +++ b/app/code/Magento/Elasticsearch/Model/Indexer/Plugin/StockedProductsFilterPlugin.php @@ -0,0 +1,94 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch\Model\Indexer\Plugin; + +use Magento\Elasticsearch\Model\Config; +use Magento\CatalogInventory\Api\StockConfigurationInterface; +use Magento\CatalogInventory\Api\StockStatusRepositoryInterface; +use Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory; +use Magento\CatalogInventory\Api\Data\StockStatusInterface; +use Magento\CatalogSearch\Model\Indexer\Fulltext\Action\DataProvider; + +/** + * Plugin for filtering child products that are out of stock for preventing their saving to catalog search index. + */ +class StockedProductsFilterPlugin +{ + /** + * @var Config + */ + private $config; + + /** + * @var StockConfigurationInterface + */ + private $stockConfiguration; + + /** + * @var StockStatusRepositoryInterface + */ + private $stockStatusRepository; + + /** + * @var StockStatusCriteriaInterfaceFactory + */ + private $stockStatusCriteriaFactory; + + /** + * @param Config $config + * @param StockConfigurationInterface $stockConfiguration + * @param StockStatusRepositoryInterface $stockStatusRepository + * @param StockStatusCriteriaInterfaceFactory $stockStatusCriteriaFactory + */ + public function __construct( + Config $config, + StockConfigurationInterface $stockConfiguration, + StockStatusRepositoryInterface $stockStatusRepository, + StockStatusCriteriaInterfaceFactory $stockStatusCriteriaFactory + ) { + $this->config = $config; + $this->stockConfiguration = $stockConfiguration; + $this->stockStatusRepository = $stockStatusRepository; + $this->stockStatusCriteriaFactory = $stockStatusCriteriaFactory; + } + + /** + * Filter out of stock options for configurable product. + * + * @param DataProvider $dataProvider + * @param array $indexData + * @param array $productData + * @param int $storeId + * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforePrepareProductIndex( + DataProvider $dataProvider, + array $indexData, + array $productData, + int $storeId + ): array { + if ($this->config->isElasticsearchEnabled() && !$this->stockConfiguration->isShowOutOfStock($storeId)) { + $productIds = array_keys($indexData); + $stockStatusCriteria = $this->stockStatusCriteriaFactory->create(); + $stockStatusCriteria->setProductsFilter($productIds); + $stockStatusCollection = $this->stockStatusRepository->getList($stockStatusCriteria); + $stockStatuses = $stockStatusCollection->getItems(); + $stockStatuses = array_filter($stockStatuses, function (StockStatusInterface $stockStatus) { + return StockStatusInterface::STATUS_IN_STOCK == $stockStatus->getStockStatus(); + }); + $indexData = array_intersect_key($indexData, $stockStatuses); + } + + return [ + $indexData, + $productData, + $storeId, + ]; + } +} diff --git a/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/DependencyUpdaterPluginTest.php b/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/DependencyUpdaterPluginTest.php new file mode 100644 index 0000000000000..9b43d7d40ab1a --- /dev/null +++ b/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/DependencyUpdaterPluginTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch\Test\Unit\Model\Indexer\Plugin; + +use Magento\Elasticsearch\Model\Config; +use Magento\Elasticsearch\Model\Indexer\Plugin\DependencyUpdaterPlugin; +use Magento\Framework\Indexer\Config\DependencyInfoProvider; +use Magento\CatalogSearch\Model\Indexer\Fulltext as CatalogSearchFulltextIndexer; +use Magento\CatalogInventory\Model\Indexer\Stock\Processor as CatalogInventoryStockIndexer; + +/** + * Test for Magento\Elasticsearch\Model\Indexer\Plugin\DependencyUpdaterPlugin class. + */ +class DependencyUpdaterPluginTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var Config|\PHPUnit_Framework_MockObject_MockObject + */ + private $configMock; + + /** + * @var DependencyUpdaterPlugin + */ + private $plugin; + + /** + * @var DependencyInfoProvider|\PHPUnit_Framework_MockObject_MockObject + */ + private $providerMock; + + protected function setUp() + { + $this->configMock = $this->getMockBuilder(Config::class) + ->disableOriginalConstructor() + ->getMock(); + $this->configMock->expects($this->exactly(2)) + ->method('isElasticsearchEnabled') + ->willReturnOnConsecutiveCalls(true, false); + $this->providerMock = $this->getMockBuilder(DependencyInfoProvider::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->plugin = new DependencyUpdaterPlugin($this->configMock); + } + + /** + * @return void + */ + public function testAfterGetIndexerIdsToRunBefore(): void + { + $dependencies = [ + CatalogInventoryStockIndexer::INDEXER_ID, + ]; + $indexerId = CatalogSearchFulltextIndexer::INDEXER_ID; + + $indexerIds = $this->plugin->afterGetIndexerIdsToRunBefore($this->providerMock, $dependencies, $indexerId); + $this->assertContains(CatalogInventoryStockIndexer::INDEXER_ID, $indexerIds); + + $indexerIds = $this->plugin->afterGetIndexerIdsToRunBefore($this->providerMock, $dependencies, $indexerId); + $this->assertNotContains(CatalogInventoryStockIndexer::INDEXER_ID, $indexerIds); + } + + /** + * @return void + */ + public function testAfterGetIndexerIdsToRunAfter(): void + { + $dependencies = [ + CatalogSearchFulltextIndexer::INDEXER_ID, + ]; + $indexerId = CatalogInventoryStockIndexer::INDEXER_ID; + + $indexerIds = $this->plugin->afterGetIndexerIdsToRunAfter($this->providerMock, $dependencies, $indexerId); + $this->assertContains(CatalogSearchFulltextIndexer::INDEXER_ID, $indexerIds); + + $indexerIds = $this->plugin->afterGetIndexerIdsToRunAfter($this->providerMock, $dependencies, $indexerId); + $this->assertNotContains(CatalogSearchFulltextIndexer::INDEXER_ID, $indexerIds); + } +} diff --git a/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/StockedProductsFilterPluginTest.php b/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/StockedProductsFilterPluginTest.php new file mode 100644 index 0000000000000..dc4a92016d1fb --- /dev/null +++ b/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/StockedProductsFilterPluginTest.php @@ -0,0 +1,131 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Elasticsearch\Test\Unit\Model\Indexer\Plugin; + +use Magento\Elasticsearch\Model\Config; +use Magento\Elasticsearch\Model\Indexer\Plugin\StockedProductsFilterPlugin; +use Magento\CatalogInventory\Api\StockConfigurationInterface; +use Magento\CatalogInventory\Api\StockStatusRepositoryInterface; +use Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory; +use Magento\CatalogInventory\Api\StockStatusCriteriaInterface; +use Magento\CatalogInventory\Api\Data\StockStatusCollectionInterface; +use Magento\CatalogInventory\Api\Data\StockStatusInterface; +use Magento\CatalogInventory\Model\Stock; +use Magento\CatalogSearch\Model\Indexer\Fulltext\Action\DataProvider; + +/** + * Test for Magento\Elasticsearch\Model\Indexer\Plugin\StockedProductsFilterPlugin class. + */ +class StockedProductsFilterPluginTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var Config|\PHPUnit_Framework_MockObject_MockObject + */ + private $configMock; + + /** + * @var StockConfigurationInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $stockConfigurationMock; + + /** + * @var StockStatusRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $stockStatusRepositoryMock; + + /** + * @var StockStatusCriteriaInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $stockStatusCriteriaFactoryMock; + + /** + * @var StockedProductsFilterPlugin + */ + private $plugin; + + protected function setUp() + { + $this->configMock = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock(); + $this->stockConfigurationMock = $this->getMockBuilder(StockConfigurationInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->stockStatusRepositoryMock = $this->getMockBuilder(StockStatusRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->stockStatusCriteriaFactoryMock = $this->getMockBuilder(StockStatusCriteriaInterfaceFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->plugin = new StockedProductsFilterPlugin( + $this->configMock, + $this->stockConfigurationMock, + $this->stockStatusRepositoryMock, + $this->stockStatusCriteriaFactoryMock + ); + } + + /** + * @return void + */ + public function testBeforePrepareProductIndex(): void + { + /** @var DataProvider|\PHPUnit_Framework_MockObject_MockObject $dataProviderMock */ + $dataProviderMock = $this->getMockBuilder(DataProvider::class)->disableOriginalConstructor()->getMock(); + $indexData = [ + 1 => [], + 2 => [], + ]; + $productData = []; + $storeId = 1; + + $this->configMock + ->expects($this->once()) + ->method('isElasticsearchEnabled') + ->willReturn(true); + $this->stockConfigurationMock + ->expects($this->once()) + ->method('isShowOutOfStock') + ->willReturn(false); + + $stockStatusCriteriaMock = $this->getMockBuilder(StockStatusCriteriaInterface::class)->getMock(); + $stockStatusCriteriaMock + ->expects($this->once()) + ->method('setProductsFilter') + ->willReturn(true); + $this->stockStatusCriteriaFactoryMock + ->expects($this->once()) + ->method('create') + ->willReturn($stockStatusCriteriaMock); + + $stockStatusMock = $this->getMockBuilder(StockStatusInterface::class)->getMock(); + $stockStatusMock->expects($this->atLeastOnce()) + ->method('getStockStatus') + ->willReturnOnConsecutiveCalls(Stock::STOCK_IN_STOCK, Stock::STOCK_OUT_OF_STOCK); + $stockStatusCollectionMock = $this->getMockBuilder(StockStatusCollectionInterface::class)->getMock(); + $stockStatusCollectionMock + ->expects($this->once()) + ->method('getItems') + ->willReturn([ + 1 => $stockStatusMock, + 2 => $stockStatusMock, + ]); + $this->stockStatusRepositoryMock + ->expects($this->once()) + ->method('getList') + ->willReturn($stockStatusCollectionMock); + + list ($indexData, $productData, $storeId) = $this->plugin->beforePrepareProductIndex( + $dataProviderMock, + $indexData, + $productData, + $storeId + ); + + $this->assertEquals([1], array_keys($indexData)); + } +} diff --git a/app/code/Magento/Elasticsearch/composer.json b/app/code/Magento/Elasticsearch/composer.json index 8e379579641d3..a6b4f93ade579 100644 --- a/app/code/Magento/Elasticsearch/composer.json +++ b/app/code/Magento/Elasticsearch/composer.json @@ -10,6 +10,7 @@ "magento/module-eav": "*", "magento/module-search": "*", "magento/module-store": "*", + "magento/module-catalog-inventory": "*", "magento/framework": "*", "elasticsearch/elasticsearch": "~2.0|~5.1" }, diff --git a/app/code/Magento/Elasticsearch/etc/di.xml b/app/code/Magento/Elasticsearch/etc/di.xml index b3ba240ae239c..2d569eecfee58 100644 --- a/app/code/Magento/Elasticsearch/etc/di.xml +++ b/app/code/Magento/Elasticsearch/etc/di.xml @@ -189,6 +189,12 @@ </argument> </arguments> </type> + <type name="Magento\CatalogSearch\Model\Indexer\Fulltext\Action\DataProvider"> + <plugin name="stockedProductsFilterPlugin" type="Magento\Elasticsearch\Model\Indexer\Plugin\StockedProductsFilterPlugin"/> + </type> + <type name="Magento\Framework\Indexer\Config\DependencyInfoProvider"> + <plugin name="indexerDependencyUpdaterPlugin" type="Magento\Elasticsearch\Model\Indexer\Plugin\DependencyUpdaterPlugin"/> + </type> <type name="Magento\Elasticsearch\SearchAdapter\Query\Builder\Match"> <arguments> <argument name="preprocessorContainer" xsi:type="array"> diff --git a/app/code/Magento/Elasticsearch/etc/indexer.xml b/app/code/Magento/Elasticsearch/etc/indexer.xml new file mode 100644 index 0000000000000..245829396a67b --- /dev/null +++ b/app/code/Magento/Elasticsearch/etc/indexer.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="urn:magento:framework:Indexer/etc/indexer.xsd"> + <indexer id="catalogsearch_fulltext"> + <dependencies> + <indexer id="cataloginventory_stock" /> + </dependencies> + </indexer> +</config> diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Client/ElasticsearchTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Client/ElasticsearchTest.php index 0731871b4bd40..61add5f7d0ea7 100644 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Client/ElasticsearchTest.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Client/ElasticsearchTest.php @@ -100,7 +100,7 @@ private function search($text) */ public function testSearchConfigurableProductBySimpleProductName() { - $this->assertProductWithSkuFound('configurable', $this->search('Configurable OptionOption')); + $this->assertProductWithSkuFound('configurable', $this->search('Configurable Option')); } /** diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/IndexHandlerTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/IndexHandlerTest.php index 4cdff533af737..36d3c809242fc 100755 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/IndexHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/IndexHandlerTest.php @@ -5,13 +5,18 @@ */ namespace Magento\Elasticsearch\Model\Indexer; -use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Action as ProductAction; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\CatalogInventory\Api\StockRegistryInterface; +use Magento\CatalogInventory\Api\StockItemRepositoryInterface; +use Magento\CatalogSearch\Model\Indexer\Fulltext as CatalogSearchFulltextIndexer; use Magento\TestFramework\Helper\Bootstrap; use Magento\Store\Model\StoreManagerInterface; use Magento\Elasticsearch\SearchAdapter\ConnectionManager; use Magento\Elasticsearch\Model\Client\Elasticsearch as ElasticsearchClient; use Magento\Elasticsearch\Model\Config; use Magento\Elasticsearch\SearchAdapter\SearchIndexNameResolver; +use Magento\Indexer\Model\Indexer; /** * Important: Please make sure that each integration test file works with unique elastic search index. In order to @@ -20,107 +25,79 @@ * * @magentoDbIsolation disabled * @magentoDataFixture Magento/Elasticsearch/_files/indexer.php + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class IndexHandlerTest extends \PHPUnit\Framework\TestCase { /** - * @var ConnectionManager + * @var ProductRepositoryInterface */ - protected $connectionManager; + private $productRepository; /** * @var ElasticsearchClient */ - protected $client; + private $client; /** * @var StoreManagerInterface */ - protected $storeManager; + private $storeManager; /** * @var int[] */ - protected $storeIds; + private $storeIds; /** - * @var Config + * @var string */ - protected $clientConfig; + private $entityType; /** - * @var SearchIndexNameResolver - */ - protected $searchIndexNameResolver; - - /** - * @var Product - */ - protected $productApple; - - /** - * @var Product - */ - protected $productBanana; - - /** - * @var Product - */ - protected $productOrange; - - /** - * @var Product + * @var Indexer */ - protected $productPapaya; + private $indexer; /** - * @var Product + * @var SearchIndexNameResolver */ - protected $productCherry; + private $searchIndexNameResolver; /** - * Setup method + * {@inheritdoc} */ protected function setUp() { - $this->connectionManager = Bootstrap::getObjectManager()->create( - \Magento\Elasticsearch\SearchAdapter\ConnectionManager::class - ); - - $this->client = $this->connectionManager->getConnection(); + $connectionManager = Bootstrap::getObjectManager()->create(ConnectionManager::class); + $this->client = $connectionManager->getConnection(); - $this->storeManager = Bootstrap::getObjectManager()->create( - \Magento\Store\Model\StoreManagerInterface::class - ); + $this->storeManager = Bootstrap::getObjectManager()->create(StoreManagerInterface::class); $this->storeIds = array_keys($this->storeManager->getStores()); - $this->clientConfig = Bootstrap::getObjectManager()->create( - \Magento\Elasticsearch\Model\Config::class - ); + $clientConfig = Bootstrap::getObjectManager()->create(Config::class); + $this->entityType = $clientConfig->getEntityType(); - $this->searchIndexNameResolver = Bootstrap::getObjectManager()->create( - \Magento\Elasticsearch\SearchAdapter\SearchIndexNameResolver::class - ); + $this->indexer = Bootstrap::getObjectManager()->create(Indexer::class); + $this->indexer->load(CatalogSearchFulltextIndexer::INDEXER_ID); + $this->indexer->reindexAll(); - $this->productApple = $this->getProductBySku('fulltext-1'); - $this->productBanana = $this->getProductBySku('fulltext-2'); - $this->productOrange = $this->getProductBySku('fulltext-3'); - $this->productPapaya = $this->getProductBySku('fulltext-4'); - $this->productCherry = $this->getProductBySku('fulltext-5'); + $this->searchIndexNameResolver = Bootstrap::getObjectManager()->create(SearchIndexNameResolver::class); + $this->productRepository = Bootstrap::getObjectManager()->create(ProductRepositoryInterface::class); } /** - * Test reindex process * @magentoConfigFixture default/catalog/search/engine elasticsearch * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix indexerhandlertest + * @return void */ - public function testReindexAll() + public function testReindexAll(): void { - $this->reindexAll(); + $productApple = $this->productRepository->get('fulltext-1'); foreach ($this->storeIds as $storeId) { $products = $this->searchByName('Apple', $storeId); $this->assertCount(1, $products); - $this->assertEquals($this->productApple->getId(), $products[0]['_id']); + $this->assertEquals($productApple->getId(), $products[0]['_id']); $products = $this->searchByName('Simple Product', $storeId); $this->assertCount(5, $products); @@ -128,19 +105,17 @@ public function testReindexAll() } /** + * @magentoAppIsolation enabled * @magentoConfigFixture default/catalog/search/engine elasticsearch * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix indexerhandlertest + * @return void */ - public function testReindexRowAfterEdit() + public function testReindexRowAfterEdit(): void { - // The test executes fine locally. On bamboo there is some issue with parallel test execution or other - // test interaction. It is being marked as skipped until more time is available to investigate and - // fix the issue. - $this->markTestSkipped('MAGETWO-53851 - Ticket to investiage this test failure on Bamboo and fix it.'); - - $this->productApple->setData('name', 'Simple Product Cucumber'); - $this->productApple->save(); - $this->reindexAll(); + $this->storeManager->setCurrentStore('admin'); + $productApple = $this->productRepository->get('fulltext-1'); + $productApple->setName('Simple Product Cucumber'); + $this->productRepository->save($productApple); foreach ($this->storeIds as $storeId) { $products = $this->searchByName('Apple', $storeId); @@ -148,7 +123,7 @@ public function testReindexRowAfterEdit() $products = $this->searchByName('Cucumber', $storeId); $this->assertCount(1, $products); - $this->assertEquals($this->productApple->getId(), $products[0]['_id']); + $this->assertEquals($productApple->getId(), $products[0]['_id']); $products = $this->searchByName('Simple Product', $storeId); $this->assertCount(5, $products); @@ -158,22 +133,21 @@ public function testReindexRowAfterEdit() /** * @magentoConfigFixture default/catalog/search/engine elasticsearch * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix indexerhandlertest + * @return void */ - public function testReindexRowAfterMassAction() + public function testReindexRowAfterMassAction(): void { - $this->reindexAll(); + $productApple = $this->productRepository->get('fulltext-1'); + $productBanana = $this->productRepository->get('fulltext-2'); $productIds = [ - $this->productApple->getId(), - $this->productBanana->getId(), + $productApple->getId(), + $productBanana->getId(), ]; $attrData = [ 'name' => 'Simple Product Common', ]; - - /** @var \Magento\Catalog\Model\Product\Action $action */ - $action = Bootstrap::getObjectManager()->get( - \Magento\Catalog\Model\Product\Action::class - ); + /** @var ProductAction $action */ + $action = Bootstrap::getObjectManager()->get(ProductAction::class); foreach ($this->storeIds as $storeId) { $action->updateAttributes($productIds, $attrData, $storeId); @@ -199,30 +173,66 @@ public function testReindexRowAfterMassAction() * @magentoConfigFixture default/catalog/search/engine elasticsearch * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix indexerhandlertest * @magentoAppArea adminhtml + * @return void */ - public function testReindexRowAfterDelete() + public function testReindexRowAfterDelete(): void { - $this->reindexAll(); - $this->productBanana->delete(); + $productBanana = $this->productRepository->get('fulltext-2'); + $this->productRepository->delete($productBanana); foreach ($this->storeIds as $storeId) { + $products = $this->searchByName('Banana', $storeId); + $this->assertEmpty($products); + $products = $this->searchByName('Simple Product', $storeId); $this->assertCount(4, $products); } } /** - * Search docs in Elasticsearch by name + * @magentoAppArea adminhtml + * @magentoConfigFixture default/catalog/search/engine elasticsearch + * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix indexerhandlertest + * @magentoDataFixture Magento/Elasticsearch/_files/configurable_products.php + * @return void + */ + public function testReindexRowAfterUpdateStockStatus(): void + { + foreach ($this->storeIds as $storeId) { + $products = $this->searchByName('ProductOption1', $storeId); + $this->assertNotEmpty($products); + } + $product = $this->productRepository->get('simple_10'); + /** @var StockRegistryInterface $stockRegistry */ + $stockRegistry = Bootstrap::getObjectManager()->create(StockRegistryInterface::class); + $stockItem = $stockRegistry->getStockItem($product->getId()); + $stockItem->setIsInStock(false); + /** @var StockItemRepositoryInterface $stockRepository */ + $stockRepository = Bootstrap::getObjectManager()->create(StockItemRepositoryInterface::class); + $stockRepository->save($stockItem); + + foreach ($this->storeIds as $storeId) { + $products = $this->searchByName('ProductOption1', $storeId); + $this->assertEmpty($products); + + $products = $this->searchByName('Configurable', $storeId); + $this->assertNotEmpty($products); + } + } + + /** + * Search docs in Elasticsearch by name. * * @param string $text * @param int $storeId * @return array */ - protected function searchByName($text, $storeId) + private function searchByName(string $text, int $storeId): array { + $index = $this->searchIndexNameResolver->getIndexName($storeId, $this->indexer->getId()); $searchQuery = [ - 'index' => $this->searchIndexNameResolver->getIndexName($storeId, 'catalogsearch_fulltext'), - 'type' => $this->clientConfig->getEntityType(), + 'index' => $index, + 'type' => $this->entityType, 'body' => [ 'query' => [ 'bool' => [ @@ -240,35 +250,7 @@ protected function searchByName($text, $storeId) ]; $queryResult = $this->client->query($searchQuery); $products = isset($queryResult['hits']['hits']) ? $queryResult['hits']['hits'] : []; - return $products; - } - - /** - * Return product by SKU - * - * @param string $sku - * @return Product - */ - protected function getProductBySku($sku) - { - /** @var Product $product */ - $product = Bootstrap::getObjectManager()->get( - \Magento\Catalog\Model\Product::class - ); - return $product->loadByAttribute('sku', $sku); - } - /** - * Perform full reindex - * - * @return void - */ - private function reindexAll() - { - $indexer = Bootstrap::getObjectManager()->create( - \Magento\Indexer\Model\Indexer::class - ); - $indexer->load('catalogsearch_fulltext'); - $indexer->reindexAll(); + return $products; } } diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute.php new file mode 100644 index 0000000000000..66d4d467bf6f4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Eav\Api\AttributeRepositoryInterface; + +$eavConfig = Bootstrap::getObjectManager()->get(\Magento\Eav\Model\Config::class); +$attribute = $eavConfig->getAttribute('catalog_product', 'test_configurable'); + +$eavConfig->clear(); + +/** @var $installer \Magento\Catalog\Setup\CategorySetup */ +$installer = Bootstrap::getObjectManager()->create(\Magento\Catalog\Setup\CategorySetup::class); + +if (!$attribute->getId()) { + + /** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ + $attribute = Bootstrap::getObjectManager()->create( + \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class + ); + + /** @var AttributeRepositoryInterface $attributeRepository */ + $attributeRepository = Bootstrap::getObjectManager()->create(AttributeRepositoryInterface::class); + + $attribute->setData( + [ + 'attribute_code' => 'test_configurable', + 'entity_type_id' => $installer->getEntityTypeId('catalog_product'), + 'is_global' => 1, + 'is_user_defined' => 1, + 'frontend_input' => 'select', + 'is_unique' => 0, + 'is_required' => 0, + 'is_searchable' => 0, + 'is_visible_in_advanced_search' => 0, + 'is_comparable' => 0, + 'is_filterable' => 0, + 'is_filterable_in_search' => 0, + 'is_used_for_promo_rules' => 0, + 'is_html_allowed_on_front' => 1, + 'is_visible_on_front' => 0, + 'used_in_product_listing' => 0, + 'used_for_sort_by' => 0, + 'frontend_label' => ['Test Configurable'], + 'backend_type' => 'int', + 'option' => [ + 'value' => ['option_0' => ['Option 1'], 'option_1' => ['Option 2']], + 'order' => ['option_0' => 1, 'option_1' => 2], + ], + ] + ); + + $attributeRepository->save($attribute); + + /* Assign attribute to attribute set */ + $installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId()); +} + +$eavConfig->clear(); diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute_rollback.php new file mode 100644 index 0000000000000..f302df996f902 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute_rollback.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +/** @var \Magento\Framework\Registry $registry */ +$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); +$productCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(\Magento\Catalog\Model\ResourceModel\Product\Collection::class); +foreach ($productCollection as $product) { + $product->delete(); +} + +$eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Eav\Model\Config::class); +$attribute = $eavConfig->getAttribute('catalog_product', 'test_configurable'); +if ($attribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute + && $attribute->getId() +) { + $attribute->delete(); +} +$eavConfig->clear(); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_products.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_products.php index c2dd3c2f879e1..f8872b02ba246 100644 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_products.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_products.php @@ -17,7 +17,7 @@ require __DIR__ . '/select_attribute.php'; require __DIR__ . '/multiselect_attribute.php'; -require __DIR__ . '/../../ConfigurableProduct/_files/configurable_attribute.php'; +require __DIR__ . '/configurable_attribute.php'; $objectManager = Bootstrap::getObjectManager(); @@ -45,7 +45,7 @@ ->setId($productId) ->setAttributeSetId($attributeSetId) ->setWebsiteIds([1]) - ->setName('Configurable Option' . $option->getLabel()) + ->setName('Configurable Option Product' . str_replace(' ', '', $option->getLabel())) ->setSku('simple_' . $productId) ->setPrice($productId) ->setTestConfigurable($option->getValue()) diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_products_rollback.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_products_rollback.php index 0d062c9d3f4e4..e73d2ab1b5906 100644 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_products_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_products_rollback.php @@ -25,7 +25,7 @@ } } -require __DIR__ . '/../../ConfigurableProduct/_files/configurable_attribute_rollback.php'; +require __DIR__ . '/configurable_attribute_rollback.php'; require __DIR__ . '/select_attribute_rollback.php'; require __DIR__ . '/multiselect_attribute_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/indexer.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/indexer.php index 8ee3a40915028..b5c86a63fa47f 100644 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/indexer.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/indexer.php @@ -52,7 +52,7 @@ ->setStockData(['use_config_manage_stock' => 0]) ->save(); -/** @var $productFirst \Magento\Catalog\Model\Product */ +/** @var $productSecond \Magento\Catalog\Model\Product */ $productSecond = $objectManager->create(\Magento\Catalog\Model\Product::class); $productSecond->setTypeId('simple') ->setAttributeSetId(4) @@ -68,7 +68,7 @@ ->setStockData(['use_config_manage_stock' => 0]) ->save(); -/** @var $productFirst \Magento\Catalog\Model\Product */ +/** @var $productThird \Magento\Catalog\Model\Product */ $productThird = $objectManager->create(\Magento\Catalog\Model\Product::class); $productThird->setTypeId('simple') ->setAttributeSetId(4) @@ -84,7 +84,7 @@ ->setStockData(['use_config_manage_stock' => 0]) ->save(); -/** @var $productFirst \Magento\Catalog\Model\Product */ +/** @var $productFourth \Magento\Catalog\Model\Product */ $productFourth = $objectManager->create(\Magento\Catalog\Model\Product::class); $productFourth->setTypeId('simple') ->setAttributeSetId(4) @@ -100,7 +100,7 @@ ->setStockData(['use_config_manage_stock' => 0]) ->save(); -/** @var $productFirst \Magento\Catalog\Model\Product */ +/** @var $productFifth \Magento\Catalog\Model\Product */ $productFifth = $objectManager->create(\Magento\Catalog\Model\Product::class); $productFifth->setTypeId('simple') ->setAttributeSetId(4) diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/requests.xml b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/requests.xml index c40ac9e8b9b1c..0aaaf9b85857f 100644 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/requests.xml +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/requests.xml @@ -394,13 +394,18 @@ <queries> <query xsi:type="boolQuery" name="filter_out_of_stock_child" boost="1"> <queryReference clause="must" ref="test_configurable"/> + <queryReference clause="must" ref="visibility"/> </query> <query xsi:type="filteredQuery" name="test_configurable"> <filterReference clause="must" ref="test_configurable_filter"/> </query> + <query xsi:type="filteredQuery" name="visibility"> + <filterReference clause="must" ref="visibility_filter"/> + </query> </queries> <filters> <filter xsi:type="termFilter" name="test_configurable_filter" field="test_configurable" value="$test_configurable$"/> + <filter xsi:type="termFilter" name="visibility_filter" field="visibility" value="$visibility$"/> </filters> <aggregations/> <from>0</from> diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/AdapterTest.php b/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/AdapterTest.php index ec1538e950c12..73d330e5dc491 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/AdapterTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Search/Adapter/Mysql/AdapterTest.php @@ -63,6 +63,10 @@ protected function setUp() ); $this->adapter = $this->createAdapter(); + + $indexer = $this->objectManager->create(\Magento\Indexer\Model\Indexer::class); + $indexer->load('catalogsearch_fulltext'); + $indexer->reindexAll(); } /** @@ -531,9 +535,15 @@ public function testAdvancedSearchCompositeProductWithOutOfStockOption() ->create(Collection::class) ->setAttributeFilter($attribute->getId()); + $visibility = [ + \Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_SEARCH, + \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH, + ]; + $firstOption = $selectOptions->getFirstItem(); $firstOptionId = $firstOption->getId(); $this->requestBuilder->bind('test_configurable', $firstOptionId); + $this->requestBuilder->bind('visibility', $visibility); $this->requestBuilder->setRequestName('filter_out_of_stock_child'); $queryResponse = $this->executeQuery(); @@ -542,6 +552,7 @@ public function testAdvancedSearchCompositeProductWithOutOfStockOption() $secondOption = $selectOptions->getLastItem(); $secondOptionId = $secondOption->getId(); $this->requestBuilder->bind('test_configurable', $secondOptionId); + $this->requestBuilder->bind('visibility', $visibility); $this->requestBuilder->setRequestName('filter_out_of_stock_child'); $queryResponse = $this->executeQuery(); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/_files/product_configurable.php b/dev/tests/integration/testsuite/Magento/Framework/Search/_files/product_configurable.php index 2f30cba3d8ee6..8a7c5246f373a 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Search/_files/product_configurable.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Search/_files/product_configurable.php @@ -15,8 +15,6 @@ use Magento\Eav\Api\Data\AttributeOptionInterface; use Magento\TestFramework\Helper\Bootstrap; -Bootstrap::getInstance()->reinitialize(); - require __DIR__ . '/configurable_attribute.php'; /** @var ProductRepositoryInterface $productRepository */ diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/_files/requests.xml b/dev/tests/integration/testsuite/Magento/Framework/Search/_files/requests.xml index 70f9ac75b07f3..dcf3cd582507c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Search/_files/requests.xml +++ b/dev/tests/integration/testsuite/Magento/Framework/Search/_files/requests.xml @@ -394,13 +394,18 @@ <queries> <query xsi:type="boolQuery" name="filter_out_of_stock_child" boost="1"> <queryReference clause="must" ref="test_configurable"/> + <queryReference clause="must" ref="visibility"/> </query> <query xsi:type="filteredQuery" name="test_configurable"> <filterReference clause="must" ref="test_configurable_filter"/> </query> + <query xsi:type="filteredQuery" name="visibility"> + <filterReference clause="must" ref="visibility_filter"/> + </query> </queries> <filters> <filter xsi:type="termFilter" name="test_configurable_filter" field="test_configurable" value="$test_configurable$"/> + <filter xsi:type="termFilter" name="visibility_filter" field="visibility" value="$visibility$"/> </filters> <aggregations/> <from>0</from> diff --git a/dev/tests/integration/testsuite/Magento/Framework/Search/_files/search_weight_products.php b/dev/tests/integration/testsuite/Magento/Framework/Search/_files/search_weight_products.php index b672fbe9f8cec..3902e78d1fb55 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Search/_files/search_weight_products.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Search/_files/search_weight_products.php @@ -7,18 +7,8 @@ */ use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Model\Product; -use Magento\Catalog\Model\Product\Attribute\Source\Status; -use Magento\Catalog\Model\Product\Type; -use Magento\Catalog\Model\Product\Visibility; -use Magento\Catalog\Setup\CategorySetup; -use Magento\ConfigurableProduct\Helper\Product\Options\Factory; -use Magento\ConfigurableProduct\Model\Product\Type\Configurable; -use Magento\Eav\Api\Data\AttributeOptionInterface; use Magento\TestFramework\Helper\Bootstrap; -Bootstrap::getInstance()->reinitialize(); - $objectManager = Bootstrap::getObjectManager(); /** @var ProductRepositoryInterface $productRepository */ From ffda0cc977d1024f68a4b86a40096ff1f310f34e Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Thu, 31 May 2018 14:45:45 +0300 Subject: [PATCH 020/133] MAGETWO-90739: Out of stock options for configurable products still show up in search and layered navigation if Elasticsearch is enabled --- app/code/Magento/Elasticsearch/Model/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Elasticsearch/Model/Config.php b/app/code/Magento/Elasticsearch/Model/Config.php index 6f4e54e96fb9b..eb033e869290f 100644 --- a/app/code/Magento/Elasticsearch/Model/Config.php +++ b/app/code/Magento/Elasticsearch/Model/Config.php @@ -61,7 +61,7 @@ class Config implements ClientOptionsInterface * @param ScopeConfigInterface $scopeConfig * @param ClientResolver|null $clientResolver * @param EngineResolver|null $engineResolver - * @param string|null $prefix + * @param string $prefix */ public function __construct( ScopeConfigInterface $scopeConfig, From 44f954173ea25153a48ddb35613ef983f29663d7 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Thu, 31 May 2018 15:39:31 -0500 Subject: [PATCH 021/133] MC-142: Guest customer should be able to advance search downloadable product with product name MC-252: Guest customer should be able to advance search downloadable product with product sku MC-243: Guest customer should be able to advance search downloadable product with product description MC-245: Guest customer should be able to advance search downloadable product with product short description MC-246: Guest customer should be able to advance search downloadable product with product price - updated mftf tests --- .../Downloadable/Data/LinkData.xml | 2 +- ...ceCatalogSearchDownloadableProductTest.xml | 25 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/LinkData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/LinkData.xml index 5099255b3a1f7..1498f4b96b3ab 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/LinkData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Data/LinkData.xml @@ -48,6 +48,6 @@ <data key="shareable">No</data> <data key="number_of_downloads">1000</data> <data key="sort_order">0</data> - <data key="link_file">https://static.magento.com/sites/all/themes/mag_redesign/images/magento-logo.svg</data> + <data key="link_url">https://static.magento.com/sites/all/themes/mag_redesign/images/magento-logo.svg</data> </entity> </entities> \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml index ef8fcf66e92de..34c8b0a815477 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml @@ -14,13 +14,12 @@ </annotations> <before> <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> - <!-- Uncomment after bug MQE-1023 is fixed --> - <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createProductOne"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> <requiredEntity createDataKey="createProductOne"/> - </createData--> + </createData> </before> </test> <test name="AdvanceCatalogSearchDownloadableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> @@ -29,13 +28,12 @@ </annotations> <before> <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> - <!-- Uncomment after bug MQE-1023 is fixed --> - <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createProductOne"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> <requiredEntity createDataKey="createProductOne"/> - </createData--> + </createData> </before> </test> <test name="AdvanceCatalogSearchDownloadableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> @@ -44,13 +42,12 @@ </annotations> <before> <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> - <!-- Uncomment after bug MQE-1023 is fixed --> - <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createProductOne"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> <requiredEntity createDataKey="createProductOne"/> - </createData--> + </createData> </before> </test> <test name="AdvanceCatalogSearchDownloadableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> @@ -59,13 +56,12 @@ </annotations> <before> <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> - <!-- Uncomment after bug MQE-1023 is fixed --> - <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createProductOne"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> <requiredEntity createDataKey="createProductOne"/> - </createData--> + </createData> </before> </test> <test name="AdvanceCatalogSearchDownloadableByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> @@ -74,13 +70,12 @@ </annotations> <before> <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> - <!-- Uncomment after bug MQE-1023 is fixed --> - <!--createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> + <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> <requiredEntity createDataKey="createProductOne"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> <requiredEntity createDataKey="createProductOne"/> - </createData--> + </createData> </before> </test> </tests> From b6cd7410214405896eb02ea89c01bdc2bdf6316a Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Thu, 31 May 2018 18:00:29 -0500 Subject: [PATCH 022/133] MC-139: Guest customer should be able to advance search bundle product with product name MC-143: Guest customer should be able to advance search bundle product with product sku MC-242: Guest customer should be able to advance search bundle product with product description MC-250: Guest customer should be able to advance search bundle product with product short description MC-251: Guest customer should be able to advance search bundle product with product price - added mftf tests --- .../Bundle/Data/BundleLinkData.xml | 21 +++ .../Bundle/Data/BundleOptionData.xml | 21 +++ .../Bundle/Data/CustomAttributeData.xml | 22 +++ .../Bundle/Data/ProductData.xml | 14 ++ .../Bundle/Metadata/bundle_link-meta.xml | 24 +++ .../Bundle/Metadata/bundle_option-meta.xml | 21 +++ .../Bundle/Metadata/bundle_options-meta.xml | 14 ++ .../AdvanceCatalogSearchBundleProductTest.xml | 151 ++++++++++++++++++ .../AdvanceCatalogSearchBundleProductTest.xml | 80 ++++++++++ 9 files changed, 368 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/BundleLinkData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/BundleOptionData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/CustomAttributeData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_link-meta.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_option-meta.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_options-meta.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchBundleProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/BundleLinkData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/BundleLinkData.xml new file mode 100644 index 0000000000000..65add76a12af3 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/BundleLinkData.xml @@ -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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/BundleOptionData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/BundleOptionData.xml new file mode 100644 index 0000000000000..02f70ec15cab8 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/BundleOptionData.xml @@ -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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/CustomAttributeData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/CustomAttributeData.xml new file mode 100644 index 0000000000000..c7f150e7ad6fb --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/CustomAttributeData.xml @@ -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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/ProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/ProductData.xml index a8598ded6ec17..69741ccd5021a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/ProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Data/ProductData.xml @@ -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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_link-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_link-meta.xml new file mode 100644 index 0000000000000..be881a7e98d65 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_link-meta.xml @@ -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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_option-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_option-meta.xml new file mode 100644 index 0000000000000..991c01ec4c6f0 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_option-meta.xml @@ -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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_options-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_options-meta.xml new file mode 100644 index 0000000000000..a81d5dda6a40b --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Metadata/bundle_options-meta.xml @@ -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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml new file mode 100644 index 0000000000000..375fe387ed424 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml @@ -0,0 +1,151 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchBundleByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="DropdownBundleOption" stepKey="bundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </getData> + <createData entity="ApiBundleLink" stepKey="createBundleLink1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="createBundleLink2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple2"/> + </createData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + </test> + <test name="AdvanceCatalogSearchBundleBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="DropdownBundleOption" stepKey="bundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </getData> + <createData entity="ApiBundleLink" stepKey="createBundleLink1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="createBundleLink2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple2"/> + </createData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + </test> + <test name="AdvanceCatalogSearchBundleByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="DropdownBundleOption" stepKey="bundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </getData> + <createData entity="ApiBundleLink" stepKey="createBundleLink1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="createBundleLink2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple2"/> + </createData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + </test> + <test name="AdvanceCatalogSearchBundleByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="DropdownBundleOption" stepKey="bundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </getData> + <createData entity="ApiBundleLink" stepKey="createBundleLink1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="createBundleLink2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple2"/> + </createData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + </test> + <test name="AdvanceCatalogSearchBundleByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="DropdownBundleOption" stepKey="bundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </createData> + <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> + <requiredEntity createDataKey="createProductOne"/> + </getData> + <createData entity="ApiBundleLink" stepKey="createBundleLink1"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <createData entity="ApiBundleLink" stepKey="createBundleLink2"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="getBundleOption"/> + <requiredEntity createDataKey="simple2"/> + </createData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchBundleProductTest.xml new file mode 100644 index 0000000000000..a94918313c206 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchBundleProductTest.xml @@ -0,0 +1,80 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchBundleByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product name"/> + <description value="Guest customer should be able to advance search Bundle product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-139"/> + <group value="CatalogSearch"/> + </annotations> + </test> + <test name="AdvanceCatalogSearchBundleBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product sku"/> + <description value="Guest customer should be able to advance search Bundle product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-143"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> + <argument name="sku" value="$$createProductOne.sku$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchBundleByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product description"/> + <description value="Guest customer should be able to advance search Bundle product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-242"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> + <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchBundleByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product short description"/> + <description value="Guest customer should be able to advance search Bundle product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-250"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> + <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchBundleByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product price"/> + <description value="Guest customer should be able to advance search Bundle product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-251"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> + <argument name="name" value="$$createProductOne.name$$"/> + <argument name="priceFrom" value="$$simple1.price$$"/> + <argument name="priceTo" value="$$simple1.price$$"/> + </actionGroup> + </test> +</tests> From 632926d7008c26096003a3a41d69e05dedb8aeb9 Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Fri, 1 Jun 2018 11:44:45 +0300 Subject: [PATCH 023/133] MAGETWO-90739: Out of stock options for configurable products still show up in search and layered navigation if Elasticsearch is enabled --- app/code/Magento/Elasticsearch/Model/Config.php | 12 +++++++++--- .../Elasticsearch/Model/Indexer/IndexHandlerTest.php | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Elasticsearch/Model/Config.php b/app/code/Magento/Elasticsearch/Model/Config.php index eb033e869290f..3d55979dfcee8 100644 --- a/app/code/Magento/Elasticsearch/Model/Config.php +++ b/app/code/Magento/Elasticsearch/Model/Config.php @@ -6,6 +6,7 @@ namespace Magento\Elasticsearch\Model; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Search\EngineResolverInterface; use Magento\Search\Model\EngineResolver; use Magento\Store\Model\ScopeInterface; use Magento\AdvancedSearch\Model\Client\ClientOptionsInterface; @@ -55,23 +56,28 @@ class Config implements ClientOptionsInterface */ private $clientResolver; + /** + * @var EngineResolverInterface + */ + private $engineResolver; + /** * Constructor * * @param ScopeConfigInterface $scopeConfig * @param ClientResolver|null $clientResolver - * @param EngineResolver|null $engineResolver + * @param EngineResolverInterface|null $engineResolver * @param string $prefix */ public function __construct( ScopeConfigInterface $scopeConfig, ClientResolver $clientResolver = null, - EngineResolver $engineResolver = null, + EngineResolverInterface $engineResolver = null, $prefix = null ) { $this->scopeConfig = $scopeConfig; $this->clientResolver = $clientResolver ?: ObjectManager::getInstance()->get(ClientResolver::class); - $this->engineResolver = $engineResolver ?: ObjectManager::getInstance()->get(EngineResolver::class); + $this->engineResolver = $engineResolver ?: ObjectManager::getInstance()->get(EngineResolverInterface::class); $this->prefix = $prefix ?: $this->clientResolver->getCurrentEngine(); } diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/IndexHandlerTest.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/IndexHandlerTest.php index 36d3c809242fc..014aaf7679bc9 100755 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/IndexHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Indexer/IndexHandlerTest.php @@ -190,6 +190,7 @@ public function testReindexRowAfterDelete(): void } /** + * @magentoDbIsolation enabled * @magentoAppArea adminhtml * @magentoConfigFixture default/catalog/search/engine elasticsearch * @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix indexerhandlertest From a0ab4e4e2b5cb4a1d602c22be0cf34dc1ea76265 Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Fri, 1 Jun 2018 13:43:43 +0300 Subject: [PATCH 024/133] MAGETWO-90739: Out of stock options for configurable products still show up in search and layered navigation if Elasticsearch is enabled --- app/code/Magento/Elasticsearch/Model/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Elasticsearch/Model/Config.php b/app/code/Magento/Elasticsearch/Model/Config.php index 3d55979dfcee8..a0f3b6433b43b 100644 --- a/app/code/Magento/Elasticsearch/Model/Config.php +++ b/app/code/Magento/Elasticsearch/Model/Config.php @@ -67,7 +67,7 @@ class Config implements ClientOptionsInterface * @param ScopeConfigInterface $scopeConfig * @param ClientResolver|null $clientResolver * @param EngineResolverInterface|null $engineResolver - * @param string $prefix + * @param string|null $prefix */ public function __construct( ScopeConfigInterface $scopeConfig, From cb24bdf7bfd48e55221f6de16690653a6b7918c5 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 1 Jun 2018 09:58:26 -0500 Subject: [PATCH 025/133] MC-234: Admin should be able to create category from the product page --- .../ActionGroup/AdminCategoryActionGroup.xml | 54 +++++++++++++++++++ .../AdminProductCategoryCreationSection.xml | 26 +++++++++ .../AdminCreateCategoryFromProductPage.xml | 44 +++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index 96e40e348a6f2..006c7ff7beb7d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -118,6 +118,60 @@ <dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(categoryEntity.name)}}" stepKey="dontSeeCategoryInTree"/> </actionGroup> + <!-- Actions to fill out a new category from the product page--> + <actionGroup name="FillNewProductCategory" > + <arguments> + <argument name="categoryName" defaultValue="Test Category" type="string"/> + </arguments> + + <!--Navigate to product page --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPage"/> + + <!-- Click first example product --> + <click stepKey="clickFirstExampleProduct" selector="{{AdminProductCategoryCreationSection.firstExampleProduct}}" /> + <waitForPageLoad stepKey="waitForSpecificProductPage"/> + + <!-- Click on new Category --> + <click stepKey="clickNewCategory" selector="{{AdminProductCategoryCreationSection.newCategory}}" /> + <waitForPageLoad stepKey="waitForFieldSet"/> + + <fillField stepKey="fillCategoryName" selector="{{AdminProductCategoryCreationSection.nameInput}}" userInput="{{categoryName}}" /> + + <click stepKey="clickParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategory}}" /> + <waitForPageLoad stepKey="waitForDropDownVisible"/> + + <click stepKey="clickDefaultParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategoryDropdownDefaultOption}}" /> + + <click stepKey="createCategory" selector="{{AdminProductCategoryCreationSection.createCategory}}" /> + </actionGroup> + + <!-- Actions to delete the category last made --> + <actionGroup name="DeleteMostRecentCategory"> + <click stepKey="goToCreateCategory" selector="{{AdminProductCategoryCreationSection.lastCreatedCategory}}" /> + <waitForPageLoad stepKey="waitForCreatedCategoryPageLoad"/> + + <click stepKey="clickDeleteCategory" selector="{{AdminProductCategoryCreationSection.categoryDeleteButton}}" /> + <waitForPageLoad stepKey="waitForModalVisible"/> + + <click stepKey="clickOkToDelete" selector="{{AdminProductCategoryCreationSection.acceptDeletion}}" /> + + <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="goToCategoryFrontPage"/> + <waitForPageLoad stepKey="waitForCategoryPageLoad"/> + + <see selector="{{AdminProductCategoryCreationSection.categoryStructure}}" userInput="{{categoryName}}" stepKey="assertCategoryOnStorefront"/> + </actionGroup> + <!--Check that name field is required--> <actionGroup name="CheckCategoryNameIsRequiredField"> <seeInCurrentUrl url="{{AdminCategoryPage.url}}" stepKey="seeOnCategoryPage"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml new file mode 100644 index 0000000000000..a983a7f24f803 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections 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="AdminProductCategoryCreationSection"> + <element name="firstExampleProduct" type="button" selector=".data-row:nth-of-type(1)" /> + <element name="newCategory" type="button" selector="//button/span[text()='New Category']" /> + + <element name="nameInput" type="input" selector="input[name='name']" /> + + <element name="parentCategory" type="block" selector=".product_form_product_form_create_category_modal div[data-role='selected-option']" /> + <element name="parentCategoryDropdownDefaultOption" type="block" selector=".product_form_product_form_create_category_modal .action-menu-item._expended .admin__action-multiselect-label" /> + <element name="createCategory" type="button" selector="#save" /> + + <element name="categoryStructure" type="button" selector="#ext-gen5" /> + <element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" /> + <element name="categoryDeleteButton" type="button" selector="//button/span[text()='Delete']" /> + <element name="acceptDeletion" type="button" selector="//button/span[text()='OK']" /> + </section> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml new file mode 100644 index 0000000000000..7986f055cbb3c --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml @@ -0,0 +1,44 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminCreateCategoryFromProductPage"> + <annotations> + <features value="Category"/> + <stories value="Admin should be able to create category from the product page"/> + <description value="Admin should be able to create category from the product page" /> + <severity value="AVERAGE" /> + <testCaseId value="MC-234" /> + <group value="Catalog" /> + </annotations> + <before> + <createData entity="SimpleTwo" stepKey="simpleProduct"> + </createData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> + </after> + + <!-- Create new category in the product page with the category of AdminCreateCategoryFromProductPage --> + <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> + <argument name="categoryName" value="AdminCreateCategoryFromProductPage" /> + </actionGroup> + + <!-- Check that category was created --> + <actionGroup ref="CategoryPresent" stepKey="checkIfCategoryPresent"> + <argument name="categoryName" value="AdminCreateCategoryFromProductPage" /> + </actionGroup> + + <!-- Delete the created category --> + <actionGroup ref="DeleteMostRecentCategory" stepKey="getRidOfCreatedCategory" /> + + </test> +</tests> From bc58afb6fae35356d14467c75a894610b89ed95b Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Tue, 29 May 2018 16:57:11 -0500 Subject: [PATCH 026/133] MC-235: Customer should only see cart price rule discount if condition subtotal equals or greater than --- .../Section/PriceRuleConditionsSection.xml | 4 + .../Test/StorefrontCartPriceRuleSubtotal.xml | 94 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/PriceRuleConditionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/PriceRuleConditionsSection.xml index 39c6dd6b31968..93ed408ce7a0e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/PriceRuleConditionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Section/PriceRuleConditionsSection.xml @@ -16,5 +16,9 @@ <element name="treeRoot" type="text" selector=".x-tree-root-ct.x-tree-lines"/> <element name="lastTreeNode" type="text" selector=".x-tree-root-ct.x-tree-lines > div > li > ul > li:last-child div img.x-tree-elbow-end-plus"/> <element name="subcategory4level" type="text" selector=".x-tree-root-ct.x-tree-lines > div > li > ul > li > ul > li > ul > li > ul > li > div img.x-tree-elbow-end-plus"/> + + <element name="ruleParamLink" type="button" selector="//*[@id='conditions__{{var1}}__children']/li[{{var2}}]/span[{{var3}}]/a" parameterized="true"/> + <element name="operatorByIndex" type="input" selector="#conditions__{{var1}}--{{var2}}__operator" parameterized="true"/> + <element name="valueByIndex" type="input" selector="#conditions__{{var1}}--{{var2}}__value" parameterized="true"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml new file mode 100644 index 0000000000000..9a2ed3d3eabd0 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml @@ -0,0 +1,94 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="StorefrontCartPriceRuleSubtotal"> + <annotations> + <features value="SalesRule"/> + <stories value="Create cart price rule"/> + <title value="Customer should only see cart price rule discount if condition subtotal equals or greater than"/> + <description value="Customer should only see cart price rule discount if condition subtotal equals or greater than"/> + <severity value="AVERAGE"/> + <testCaseId value="MC-235"/> + <group value="SalesRule"/> + </annotations> + + <before> + <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + + <after> + <!-- Delete the cart price rule we made during the test --> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> + <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> + </actionGroup> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!-- Create the rule... --> + <!-- Fill basic Rule Information fields --> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForRulesPage"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <!-- Fill Conditions section --> + <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> + <!-- Scroll down to fix some flaky behavior... --> + <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> + <click selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="clickNewRule"/> + <selectOption selector="{{PriceRuleConditionsSection.rulesDropdown}}" userInput="Subtotal" stepKey="selectProductAttributes"/> + <waitForPageLoad stepKey="waitForConditions"/> + <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '1')}}" stepKey="startEditOperator"/> + <selectOption selector="{{PriceRuleConditionsSection.operatorByIndex('1', '1')}}" userInput="equals or greater than" stepKey="fillOperator"/> + <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '2')}}" stepKey="startEditValue"/> + <fillField selector="{{PriceRuleConditionsSection.valueByIndex('1', '1')}}" userInput="200" stepKey="fillValue"/> + <!-- Fill Actions section --> + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="0.01" stepKey="fillDiscountAmount"/> + <!-- Save the rule --> + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + + <!-- Create a product to use in the storefront --> + <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <argument name="category" value="$$createPreReqCategory$$"/> + <argument name="simpleProduct" value="_defaultProduct"/> + </actionGroup> + + <!-- Add the product we created to our cart --> + <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + + <!-- Should not see the discount yet because we have not exceeded $200 --> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> + <waitForPageLoad stepKey="waitForCartPage"/> + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$123.00" stepKey="seeSubtotal"/> + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/> + + <!-- Add another of the product to our cart --> + <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage2"/> + <waitForPageLoad stepKey="waitForProductPageLoad2"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity2"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart2"/> + + <!-- Now we should see the discount because we exceeded $200 --> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage2"/> + <waitForPageLoad stepKey="waitForCartPage2"/> + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$246.00" stepKey="seeSubtotal2"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$0.01" stepKey="seeDiscountTotal"/> + </test> +</tests> From 97561e2066592d9967e7c86c6ecace9474f3d1c2 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Wed, 30 May 2018 15:19:57 -0500 Subject: [PATCH 027/133] MC-236: Customer should only see cart price rule discount if condition total items quantity greater than --- .../Test/StorefrontCartPriceRuleQuantity.xml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml new file mode 100644 index 0000000000000..2a3f20b49c962 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml @@ -0,0 +1,95 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="StorefrontCartPriceRuleQuantity"> + <annotations> + <features value="SalesRule"/> + <stories value="Create cart price rule"/> + <title value="Customer should only see cart price rule discount if condition total items quantity greater than"/> + <description value="Customer should only see cart price rule discount if condition total items quantity greater than"/> + <severity value="AVERAGE"/> + <testCaseId value="MC-236"/> + <group value="SalesRule"/> + </annotations> + + <before> + <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + + <after> + <!-- Delete the cart price rule we made during the test --> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> + <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> + </actionGroup> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!-- Create the rule... --> + <!-- Fill basic Rule Information fields --> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForRulesPage"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <!-- Fill Conditions section --> + <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> + <!-- Scroll down to fix some flaky behavior... --> + <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> + <waitForElementVisible selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="waitForNewRule"/> + <click selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="clickNewRule"/> + <selectOption selector="{{PriceRuleConditionsSection.rulesDropdown}}" userInput="Total Items Quantity" stepKey="selectProductAttributes"/> + <waitForPageLoad stepKey="waitForConditions"/> + <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '1')}}" stepKey="startEditOperator"/> + <selectOption selector="{{PriceRuleConditionsSection.operatorByIndex('1', '1')}}" userInput="greater than" stepKey="fillOperator"/> + <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '2')}}" stepKey="startEditValue"/> + <fillField selector="{{PriceRuleConditionsSection.valueByIndex('1', '1')}}" userInput="1" stepKey="fillValue"/> + <!-- Fill Actions section --> + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="1.00" stepKey="fillDiscountAmount"/> + <!-- Save the rule --> + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + + <!-- Create a product to use in the storefront --> + <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> + <argument name="category" value="$$createPreReqCategory$$"/> + <argument name="simpleProduct" value="_defaultProduct"/> + </actionGroup> + + <!-- Add the product we created to our cart --> + <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + + <!-- Should not see the discount yet because we have only 1 item in our cart --> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> + <waitForPageLoad stepKey="waitForCartPage"/> + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$123.00" stepKey="seeSubtotal"/> + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/> + + <!-- Add another of the product to our cart --> + <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage2"/> + <waitForPageLoad stepKey="waitForProductPageLoad2"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity2"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart2"/> + + <!-- Now we should see the discount because we have more than 1 item --> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage2"/> + <waitForPageLoad stepKey="waitForCartPage2"/> + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$246.00" stepKey="seeSubtotal2"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$1.00" stepKey="seeDiscountTotal"/> + </test> +</tests> From e7705ffcb60fa28fbcc13adea530b6265953a4ae Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Fri, 1 Jun 2018 13:52:51 -0500 Subject: [PATCH 028/133] MC-235: Customer should only see cart price rule discount if condition subtotal equals or greater than - Create products via api instead of ui --- .../Test/StorefrontCartPriceRuleQuantity.xml | 25 ++++++++----------- .../Test/StorefrontCartPriceRuleSubtotal.xml | 25 ++++++++----------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml index 2a3f20b49c962..4c206776a676d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml @@ -21,27 +21,28 @@ <before> <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + <createData entity="_defaultProduct" stepKey="createPreReqProduct"> + <requiredEntity createDataKey="createPreReqCategory"/> + </createData> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <!-- Delete the cart price rule we made during the test --> <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct"/> <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> </after> <!-- Create the rule... --> - <!-- Fill basic Rule Information fields --> <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> <waitForPageLoad stepKey="waitForRulesPage"/> <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> - <!-- Fill Conditions section --> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> <!-- Scroll down to fix some flaky behavior... --> <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> @@ -53,25 +54,18 @@ <selectOption selector="{{PriceRuleConditionsSection.operatorByIndex('1', '1')}}" userInput="greater than" stepKey="fillOperator"/> <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '2')}}" stepKey="startEditValue"/> <fillField selector="{{PriceRuleConditionsSection.valueByIndex('1', '1')}}" userInput="1" stepKey="fillValue"/> - <!-- Fill Actions section --> <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="1.00" stepKey="fillDiscountAmount"/> - <!-- Save the rule --> <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> - <!-- Create a product to use in the storefront --> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> - <argument name="category" value="$$createPreReqCategory$$"/> - <argument name="simpleProduct" value="_defaultProduct"/> - </actionGroup> - - <!-- Add the product we created to our cart --> - <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage"/> + <!-- Add 1 product to the cart --> + <amOnPage url="$$createPreReqProduct.name$$.html" stepKey="goToProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> <!-- Should not see the discount yet because we have only 1 item in our cart --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> @@ -79,11 +73,12 @@ <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$123.00" stepKey="seeSubtotal"/> <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/> - <!-- Add another of the product to our cart --> - <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage2"/> + <!-- Add the same product to the cart again (2 total) --> + <amOnPage url="$$createPreReqProduct.name$$.html" stepKey="goToProductPage2"/> <waitForPageLoad stepKey="waitForProductPageLoad2"/> <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity2"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart2"/> + <waitForPageLoad stepKey="waitForAddToCart2"/> <!-- Now we should see the discount because we have more than 1 item --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage2"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml index 9a2ed3d3eabd0..0f3a1568d0fef 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml @@ -21,27 +21,28 @@ <before> <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + <createData entity="_defaultProduct" stepKey="createPreReqProduct"> + <requiredEntity createDataKey="createPreReqCategory"/> + </createData> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <!-- Delete the cart price rule we made during the test --> <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct"/> <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> </after> <!-- Create the rule... --> - <!-- Fill basic Rule Information fields --> <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> <waitForPageLoad stepKey="waitForRulesPage"/> <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> - <!-- Fill Conditions section --> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> <!-- Scroll down to fix some flaky behavior... --> <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> @@ -52,25 +53,18 @@ <selectOption selector="{{PriceRuleConditionsSection.operatorByIndex('1', '1')}}" userInput="equals or greater than" stepKey="fillOperator"/> <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '2')}}" stepKey="startEditValue"/> <fillField selector="{{PriceRuleConditionsSection.valueByIndex('1', '1')}}" userInput="200" stepKey="fillValue"/> - <!-- Fill Actions section --> <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="0.01" stepKey="fillDiscountAmount"/> - <!-- Save the rule --> <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> - <!-- Create a product to use in the storefront --> - <actionGroup ref="FillAdminSimpleProductForm" stepKey="fillProductFieldsInAdmin"> - <argument name="category" value="$$createPreReqCategory$$"/> - <argument name="simpleProduct" value="_defaultProduct"/> - </actionGroup> - - <!-- Add the product we created to our cart --> - <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage"/> + <!-- Add 1 product worth $123.00 to the cart --> + <amOnPage url="$$createPreReqProduct.name$$.html" stepKey="goToProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> <!-- Should not see the discount yet because we have not exceeded $200 --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> @@ -78,11 +72,12 @@ <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$123.00" stepKey="seeSubtotal"/> <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/> - <!-- Add another of the product to our cart --> - <amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="goToProductPage2"/> + <!-- Add the same product to the cart again ($246.00 subtotal) --> + <amOnPage url="$$createPreReqProduct.name$$.html" stepKey="goToProductPage2"/> <waitForPageLoad stepKey="waitForProductPageLoad2"/> <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity2"/> <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart2"/> + <waitForPageLoad stepKey="waitForAddToCart2"/> <!-- Now we should see the discount because we exceeded $200 --> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage2"/> From b8773b58b9b73b9badc4b637b9e13cc53d162988 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Fri, 1 Jun 2018 16:09:47 -0500 Subject: [PATCH 029/133] MC-238: Customer should only see cart price rule discount if condition shipping postcode --- .../Section/CheckoutCartSummarySection.xml | 2 + .../Test/StorefrontCartPriceRulePostcode.xml | 92 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRulePostcode.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml index 32a57a14cd9da..31dd20e74ebc3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml @@ -15,5 +15,7 @@ <element name="total" type="text" selector="//*[@id='cart-totals']//tr[@class='grand totals']//td//span[@class='price']"/> <element name="proceedToCheckout" type="button" selector=".action.primary.checkout span" timeout="30"/> <element name="discountAmount" type="text" selector="td[data-th='Discount']"/> + <element name="shippingHeading" type="button" selector="#block-shipping-heading"/> + <element name="postcode" type="input" selector="input[name='postcode']"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRulePostcode.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRulePostcode.xml new file mode 100644 index 0000000000000..1d8aba54f3675 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRulePostcode.xml @@ -0,0 +1,92 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="StorefrontCartPriceRulePostcode"> + <annotations> + <features value="SalesRule"/> + <stories value="Create cart price rule"/> + <title value="Customer should only see cart price rule discount if condition shipping postcode"/> + <description value="Customer should only see cart price rule discount if condition shipping postcode"/> + <severity value="AVERAGE"/> + <testCaseId value="MC-238"/> + <group value="SalesRule"/> + </annotations> + + <before> + <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + <createData entity="_defaultProduct" stepKey="createPreReqProduct"> + <requiredEntity createDataKey="createPreReqCategory"/> + </createData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + + <after> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> + <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> + </actionGroup> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!-- Create the rule... --> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForRulesPage"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> + <!-- Scroll down to fix some flaky behavior... --> + <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> + <waitForElementVisible selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="waitForNewRule"/> + <click selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="clickNewRule"/> + <selectOption selector="{{PriceRuleConditionsSection.rulesDropdown}}" userInput="Shipping Postcode" stepKey="selectProductAttributes"/> + <waitForPageLoad stepKey="wait1"/> + <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '1')}}" stepKey="startEditOperator"/> + <waitForPageLoad stepKey="wait2"/> + <selectOption selector="{{PriceRuleConditionsSection.operatorByIndex('1', '1')}}" userInput="is one of" stepKey="fillOperator"/> + <waitForPageLoad stepKey="wait3"/> + <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '2')}}" stepKey="startEditValue"/> + <waitForPageLoad stepKey="wait4"/> + <fillField selector="{{PriceRuleConditionsSection.valueByIndex('1', '1')}}" userInput="78613" stepKey="fillValue"/> + <waitForPageLoad stepKey="wait5"/> + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="9.99" stepKey="fillDiscountAmount"/> + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + + <!-- Add the product we created to our cart --> + <amOnPage url="$$createPreReqProduct.name$$.html" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> + + <!-- Should not see the discount yet because we have not filled in postcode --> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> + <waitForPageLoad stepKey="waitForCartPage"/> + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$123.00" stepKey="seeSubtotal"/> + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/> + + <!-- See discount if we use valid postcode --> + <click selector="{{CheckoutCartSummarySection.shippingHeading}}" stepKey="expandShipping"/> + <fillField selector="{{CheckoutCartSummarySection.postcode}}" userInput="78613" stepKey="fillPostcode"/> + <waitForPageLoad stepKey="waitForPostcode1"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$9.99" stepKey="seeDiscountTotal"/> + + <!-- Do not see discount with other postcode --> + <fillField selector="{{CheckoutCartSummarySection.postcode}}" userInput="90210" stepKey="fillPostcode2"/> + <waitForPageLoad stepKey="waitForPostcode2"/> + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount2"/> + </test> +</tests> From d4464646eb3021d4375eab61cfb490dadad5454c Mon Sep 17 00:00:00 2001 From: Nathan Smith <nathanjosiah@gmail.com> Date: Fri, 1 Jun 2018 16:44:18 -0500 Subject: [PATCH 030/133] MAGETWO-92021: Improving dev experience for Products content type - updated regex to allow dot separators in keys --- .../view/adminhtml/web/conditions-data-normalizer.js | 6 +++--- .../adminhtml/web/conditions-data-normalizer.test.js | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.js b/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.js index c9c36c4fa585a..8eebc9ef0bd40 100644 --- a/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.js +++ b/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.js @@ -14,11 +14,11 @@ define([ */ var ConditionsDataNormalizer = function () { this.patterns = { - validate: /^[a-z0-9_-][a-z0-9_-]*(?:\[(?:\d*|[a-z0-9_-]+)\])*$/i, - key: /[a-z0-9_-]+|(?=\[\])/gi, + validate: /^[a-z0-9_.-][a-z0-9_.-]*(?:\[(?:\d*|[a-z0-9_.-]+)\])*$/i, + key: /[a-z0-9_.-]+|(?=\[\])/gi, push: /^$/, fixed: /^\d+$/, - named: /^[a-z0-9_-]+$/i + named: /^[a-z0-9_.-]+$/i }; }; diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.test.js index 21c04d098ae6c..ec820e537789a 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.test.js @@ -65,5 +65,17 @@ define([ expect(normal.foo['1'].value).toEqual(123); expect(normal.foo['1--1']).toEqual(321); }); + + it('Check keys containing a dot are normalized', function () { + var normal = normalizer.normalize({ + 'foo[1][name.foo]': 'bar', + 'foo[1][value.foo]': 123, + 'foo[1--1]': 321 + }); + + expect(normal.foo['1']['name.foo']).toEqual('bar'); + expect(normal.foo['1']['value.foo']).toEqual(123); + expect(normal.foo['1--1']).toEqual(321); + }); }); }); From b108cc8fa26f6ace43350cab1f7e52fa73d3ff63 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Fri, 1 Jun 2018 16:50:41 -0500 Subject: [PATCH 031/133] MC-239: Customer should only see cart price rule discount if condition shipping state/province --- .../Section/CheckoutCartSummarySection.xml | 1 + .../Test/StorefrontCartPriceRuleState.xml | 89 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml index 31dd20e74ebc3..27d23143aff9d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml @@ -17,5 +17,6 @@ <element name="discountAmount" type="text" selector="td[data-th='Discount']"/> <element name="shippingHeading" type="button" selector="#block-shipping-heading"/> <element name="postcode" type="input" selector="input[name='postcode']"/> + <element name="stateProvince" type="select" selector="select[name='region_id']"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml new file mode 100644 index 0000000000000..a5c4a18591f31 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml @@ -0,0 +1,89 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="StorefrontCartPriceRuleState"> + <annotations> + <features value="SalesRule"/> + <stories value="Create cart price rule"/> + <title value=""/> + <description value=""/> + <severity value="AVERAGE"/> + <testCaseId value="MC-239"/> + <group value="SalesRule"/> + <group value="banana"/> + </annotations> + + <before> + <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + <createData entity="_defaultProduct" stepKey="createPreReqProduct"> + <requiredEntity createDataKey="createPreReqCategory"/> + </createData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + + <after> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> + <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> + </actionGroup> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!-- Create the rule... --> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForRulesPage"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> + <!-- Scroll down to fix some flaky behavior... --> + <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> + <waitForElementVisible selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="waitForNewRule"/> + <click selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="clickNewRule"/> + <selectOption selector="{{PriceRuleConditionsSection.rulesDropdown}}" userInput="Shipping State/Province" stepKey="selectProductAttributes"/> + <waitForPageLoad stepKey="wait1"/> + <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '2')}}" stepKey="startEditValue"/> + <waitForPageLoad stepKey="wait2"/> + <selectOption selector="{{PriceRuleConditionsSection.valueByIndex('1', '1')}}" userInput="Indiana" stepKey="fillValue"/> + <waitForPageLoad stepKey="wait3"/> + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="9.99" stepKey="fillDiscountAmount"/> + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + + <!-- Add the product we created to our cart --> + <amOnPage url="$$createPreReqProduct.name$$.html" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> + + <!-- Should not see the discount yet because we have not filled in postcode --> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> + <waitForPageLoad stepKey="waitForCartPage"/> + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$123.00" stepKey="seeSubtotal"/> + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/> + + <!-- See discount if we use valid postcode --> + <click selector="{{CheckoutCartSummarySection.shippingHeading}}" stepKey="expandShipping"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="Indiana" stepKey="fillState"/> + <waitForPageLoad stepKey="waitForPostcode1"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$9.99" stepKey="seeDiscountTotal"/> + + <!-- Do not see discount with other postcode --> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="Texas" stepKey="fillState2"/> + <waitForPageLoad stepKey="waitForPostcode2"/> + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount2"/> + </test> +</tests> From 7259c4bc329c3b9b9541d3113bb46f3ba2f131d3 Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta <riccardo.tempesta@magespecialist.it> Date: Sat, 2 Jun 2018 12:14:12 +0200 Subject: [PATCH 032/133] Fulltext replacement with like condition when a SearchCriteria is applied to a DB collection. See https://github.com/magento-engcom/msi/issues/1221 --- .../CollectionProcessor/FilterProcessor.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php index b663a3a2f733c..c9f10c183b50c 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php @@ -72,6 +72,15 @@ private function addFilterGroupToCollection( if (!$isApplied) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $fields[] = $this->getFieldMapping($filter->getField()); + + if ($condition === 'fulltext') { + // NOTE: This is not a fulltext search, but the best way to search something when + // a SearchCriteria with "fulltext" condition is provided over a MySQL table + // (see https://github.com/magento-engcom/msi/issues/1221) + $condition = 'like'; + $filter->setValue('%' . $filter->getValue() . '%'); + } + $conditions[] = [$condition => $filter->getValue()]; } } From d1ed33c6a3e674f8ea6adf97c47d29a0ea480cf2 Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Mon, 4 Jun 2018 14:38:41 +0300 Subject: [PATCH 033/133] MAGETWO-90739: Out of stock options for configurable products still show up in search and layered navigation if Elasticsearch is enabled --- .../Model/Indexer/Plugin/DependencyUpdaterPluginTest.php | 3 +++ .../Model/Indexer/Plugin/StockedProductsFilterPluginTest.php | 3 +++ .../Magento/Elasticsearch/_files/configurable_attribute.php | 1 - .../Elasticsearch/_files/configurable_attribute_rollback.php | 5 ----- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/DependencyUpdaterPluginTest.php b/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/DependencyUpdaterPluginTest.php index 9b43d7d40ab1a..15510843b0e60 100644 --- a/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/DependencyUpdaterPluginTest.php +++ b/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/DependencyUpdaterPluginTest.php @@ -33,6 +33,9 @@ class DependencyUpdaterPluginTest extends \PHPUnit\Framework\TestCase */ private $providerMock; + /** + * {@inheritdoc} + */ protected function setUp() { $this->configMock = $this->getMockBuilder(Config::class) diff --git a/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/StockedProductsFilterPluginTest.php b/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/StockedProductsFilterPluginTest.php index dc4a92016d1fb..f66d2532b32ae 100644 --- a/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/StockedProductsFilterPluginTest.php +++ b/app/code/Magento/Elasticsearch/Test/Unit/Model/Indexer/Plugin/StockedProductsFilterPluginTest.php @@ -48,6 +48,9 @@ class StockedProductsFilterPluginTest extends \PHPUnit\Framework\TestCase */ private $plugin; + /** + * {@inheritdoc} + */ protected function setUp() { $this->configMock = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute.php index 66d4d467bf6f4..7ec53d9099d35 100644 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute.php @@ -17,7 +17,6 @@ $installer = Bootstrap::getObjectManager()->create(\Magento\Catalog\Setup\CategorySetup::class); if (!$attribute->getId()) { - /** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ $attribute = Bootstrap::getObjectManager()->create( \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class diff --git a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute_rollback.php index f302df996f902..7bdfbc6d7f9b3 100644 --- a/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Elasticsearch/_files/configurable_attribute_rollback.php @@ -10,11 +10,6 @@ $registry->unregister('isSecureArea'); $registry->register('isSecureArea', true); -$productCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get(\Magento\Catalog\Model\ResourceModel\Product\Collection::class); -foreach ($productCollection as $product) { - $product->delete(); -} $eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Eav\Model\Config::class); $attribute = $eavConfig->getAttribute('catalog_product', 'test_configurable'); From ac51a3ca2d6f902cb29e69c342d4fb7c05659de6 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Mon, 4 Jun 2018 10:09:47 -0500 Subject: [PATCH 034/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 --- .../Adminhtml/Product/Attribute/Save.php | 23 +++++++++++++++ .../Catalog/view/adminhtml/web/js/options.js | 28 ++++++++++++++++--- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 6a9abe0a4c64e..31c98af39c040 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -69,6 +69,7 @@ class Save extends Attribute * @var LayoutFactory */ private $layoutFactory; + /** * @var Presentation */ @@ -124,6 +125,7 @@ public function execute() { $data = $this->getRequest()->getPostValue(); if ($data) { + $this->extractOptionsData($data); $setId = $this->getRequest()->getParam('set'); $attributeSet = null; @@ -315,6 +317,27 @@ public function execute() return $this->returnResult('catalog/*/', [], ['error' => true]); } + /** + * Extract options data from serialized options field. + * This logic is required to overcome max_input_vars php limit + * that may vary and/or be inaccessible to change on different instances. + * + * @param array $data + * @return void + */ + private function extractOptionsData(&$data) + { + if (isset($data['serialized_options'])) { + unset($data['option']); + $serializedOptions = json_decode($data['serialized_options'], JSON_OBJECT_AS_ARRAY); + foreach ($serializedOptions as $serializedOption) { + $option = []; + parse_str($serializedOption, $option); + $data = array_replace_recursive($data, $option); + } + } + } + /** * @param string $path * @param array $params diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index 787516a9abf29..ce9dc4870b941 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -13,12 +13,16 @@ define([ 'jquery/ui', 'prototype', 'form', - 'validation' + 'validation', + 'mage/translate' ], function (jQuery, mageTemplate, rg) { 'use strict'; return function (config) { - var attributeOption = { + var optionPanel = jQuery('#manage-options-panel'), + optionsValues = [], + editForm = jQuery('#edit_form'), + attributeOption = { table: $('attribute-options-table'), itemCount: 0, totalItems: 0, @@ -150,7 +154,7 @@ define([ attributeOption.remove(event); }); - jQuery('#manage-options-panel').on('render', function () { + optionPanel.on('render', function () { attributeOption.ignoreValidate(); if (attributeOption.rendered) { @@ -176,7 +180,23 @@ define([ }); }); } - + editForm.on('submit', function () { + editForm + .find('input[name^="option"]') + .each(function() { + optionsValues.push(this.name + '=' + jQuery(this).val()); + this.closest('tr').hide() + }); + jQuery('<input>') + .attr({ + type: 'hidden', + name: 'serialized_options' + }) + .val(JSON.stringify(optionsValues)) + .prependTo('#edit_form'); + optionPanel.find('table') + .replaceWith(jQuery('<div>').text(jQuery.mage.__('Sending attribute values as package.'))); + }); window.attributeOption = attributeOption; window.optionDefaultInputType = attributeOption.getOptionInputType(); From 64c975aa8efe32c0f4b7bb9d4510ca261404116b Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Mon, 4 Jun 2018 10:12:08 -0500 Subject: [PATCH 035/133] MC-239: Customer should only see cart price rule discount if condition shipping state/province - Fill in missing title, description. - Remove "banana" testing group --- .../SalesRule/Test/StorefrontCartPriceRuleState.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml index a5c4a18591f31..13238b507393a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml @@ -12,12 +12,11 @@ <annotations> <features value="SalesRule"/> <stories value="Create cart price rule"/> - <title value=""/> - <description value=""/> + <title value="Customer should only see cart price rule discount if condition shipping state/province"/> + <description value="Customer should only see cart price rule discount if condition shipping state/province"/> <severity value="AVERAGE"/> <testCaseId value="MC-239"/> <group value="SalesRule"/> - <group value="banana"/> </annotations> <before> From 3c9066cf0bbc7ba1c90e4d2e72e350d45fcf4bbf Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Mon, 4 Jun 2018 10:39:20 -0500 Subject: [PATCH 036/133] MC-241: Customer should only see cart price rule discount if condition shipping country --- .../Section/CheckoutCartSummarySection.xml | 1 + .../Test/StorefrontCartPriceRuleCountry.xml | 88 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleCountry.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml index 27d23143aff9d..248070940542c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartSummarySection.xml @@ -18,5 +18,6 @@ <element name="shippingHeading" type="button" selector="#block-shipping-heading"/> <element name="postcode" type="input" selector="input[name='postcode']"/> <element name="stateProvince" type="select" selector="select[name='region_id']"/> + <element name="country" type="select" selector="select[name='country_id']"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleCountry.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleCountry.xml new file mode 100644 index 0000000000000..0f7bf3d9eaf33 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleCountry.xml @@ -0,0 +1,88 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="StorefrontCartPriceRuleCountry"> + <annotations> + <features value="SalesRule"/> + <stories value="Create cart price rule"/> + <title value="Customer should only see cart price rule discount if condition shipping country"/> + <description value="Customer should only see cart price rule discount if condition shipping country"/> + <severity value="AVERAGE"/> + <testCaseId value="MC-241"/> + <group value="SalesRule"/> + </annotations> + + <before> + <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> + <createData entity="_defaultProduct" stepKey="createPreReqProduct"> + <requiredEntity createDataKey="createPreReqCategory"/> + </createData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + + <after> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="cleanUpRule"> + <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> + </actionGroup> + <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> + <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!-- Create the rule... --> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> + <waitForPageLoad stepKey="waitForRulesPage"/> + <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> + <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> + <!-- Scroll down to fix some flaky behavior... --> + <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> + <waitForElementVisible selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="waitForNewRule"/> + <click selector="{{PriceRuleConditionsSection.createNewRule}}" stepKey="clickNewRule"/> + <selectOption selector="{{PriceRuleConditionsSection.rulesDropdown}}" userInput="Shipping Country" stepKey="selectProductAttributes"/> + <waitForPageLoad stepKey="wait1"/> + <click selector="{{PriceRuleConditionsSection.ruleParamLink('1', '1', '2')}}" stepKey="startEditValue"/> + <waitForPageLoad stepKey="wait4"/> + <selectOption selector="{{PriceRuleConditionsSection.valueByIndex('1', '1')}}" userInput="Brazil" stepKey="fillValue"/> + <waitForPageLoad stepKey="wait5"/> + <click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="9.99" stepKey="fillDiscountAmount"/> + <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> + <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> + + <!-- Add the product we created to our cart --> + <amOnPage url="$$createPreReqProduct.name$$.html" stepKey="goToProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="1" stepKey="fillQuantity"/> + <click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/> + <waitForPageLoad stepKey="waitForAddToCart"/> + + <!-- Should not see the discount yet because we have not set country --> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCartPage"/> + <waitForPageLoad stepKey="waitForCartPage"/> + <see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$123.00" stepKey="seeSubtotal"/> + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount"/> + + <!-- See discount if we use valid country --> + <click selector="{{CheckoutCartSummarySection.shippingHeading}}" stepKey="expandShipping"/> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="Brazil" stepKey="fillCountry"/> + <waitForPageLoad stepKey="waitForCountry1"/> + <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> + <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-$9.99" stepKey="seeDiscountTotal"/> + + <!-- Do not see discount with other country --> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="fillCountry2"/> + <waitForPageLoad stepKey="waitForCountry2"/> + <dontSeeElement selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="dontSeeDiscount2"/> + </test> +</tests> From dc1400ebfdc1e4245a228ea2b11a2969cbbfd186 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Mon, 4 Jun 2018 15:09:10 -0500 Subject: [PATCH 037/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 --- .../Adminhtml/Product/AttributeTest.php | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index fdc85941b32e9..00ee7afeba1e0 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Framework\Exception\LocalizedException; /** * @magentoAppArea adminhtml @@ -224,6 +225,104 @@ public function testSaveActionCleanAttributeLabelCache() $this->assertEquals('new string translation', $this->_translate('string to translate')); } + /** + * Get attribute data preset. + * + * @return array + */ + private function getLargeOptionsSetAttributeData() + { + return [ + 'frontend_label' => [ + 0 => 'testdrop1', + 1 => '', + 2 => '', + ], + 'frontend_input' => 'select', + 'is_required' => '0', + 'update_product_preview_image' => '0', + 'use_product_image_for_swatch' => '0', + 'visual_swatch_validation' => '', + 'visual_swatch_validation_unique' => '', + 'text_swatch_validation' => '', + 'text_swatch_validation_unique' => '', + 'attribute_code' => 'test_many_options', + 'is_global' => '0', + 'default_value_text' => '', + 'default_value_yesno' => '0', + 'default_value_date' => '', + 'default_value_textarea' => '', + 'is_unique' => '0', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '0', + 'is_comparable' => '0', + 'is_filterable' => '0', + 'is_filterable_in_search' => '0', + 'is_used_for_promo_rules' => '0', + 'is_html_allowed_on_front' => '1', + 'is_visible_on_front' => '0', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '0', + 'swatch_input_type' => 'dropdown', + ]; + } + + /** + * Test attribute saving with large amount of options exceeding maximum allowed by max_input_vars limit. + * @return void + */ + public function testLargeOptionsDataSet() + { + $maxInputVars = ini_get('max_input_vars'); + // Each option is at least 4 variables array (order, admin value, first store view value, delete flag). + // Set options count to exceed max_input_vars by 100 options (400 variables). + $optionsCount = floor($maxInputVars / 4) + 100; + $attributeData = $this->getLargeOptionsSetAttributeData(); + $optionsData = []; + $expectedOptionsLabels = []; + for ($i = 0; $i < $optionsCount; $i++) { + $order = $i + 1; + $expectedOptionLabelOnStoreView = "value_{$i}_store_1"; + $expectedOptionsLabels[$i+1] = $expectedOptionLabelOnStoreView; + $optionsData []= "option[order][option_{$i}]={$order}"; + $optionsData []= "option[value][option_{$i}][0]=value_{$i}_admin"; + $optionsData []= "option[value][option_{$i}][1]={$expectedOptionLabelOnStoreView}"; + $optionsData []= "option[delete][option_{$i}="; + } + $attributeData['serialized_options'] = json_encode($optionsData); + $this->getRequest()->setPostValue($attributeData); + $this->dispatch('backend/catalog/product_attribute/save'); + $entityTypeId = $this->_objectManager->create( + \Magento\Eav\Model\Entity::class + )->setType( + \Magento\Catalog\Model\Product::ENTITY + )->getTypeId(); + + /** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ + $attribute = $this->_objectManager->create( + \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class + )->setEntityTypeId( + $entityTypeId + ); + try { + $attribute->loadByCode($entityTypeId, 'test_many_options'); + $options = $attribute->getOptions(); + // assert that all options are saved without truncation + $this->assertEquals( + $optionsCount + 1, + count($options), + 'Expected options count does not match (regarding first empty option for non-required attribute)' + ); + + foreach ($expectedOptionsLabels as $optionOrderNum => $label) { + $this->assertEquals($label, $options[$optionOrderNum]->getLabel(), 'Label does not match expected.'); + } + } catch (LocalizedException $e) { + $this->fail('Test failed with exception on attribute model load: ' . $e); + } + } /** * Return translation for a string literal belonging to backend area * From 18cb5bdbd441cb4df1c9351ad394682eed939f88 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Mon, 4 Jun 2018 15:22:59 -0500 Subject: [PATCH 038/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 --- .../Catalog/Controller/Adminhtml/Product/AttributeTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index 00ee7afeba1e0..c037e48758c85 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -317,12 +317,17 @@ public function testLargeOptionsDataSet() ); foreach ($expectedOptionsLabels as $optionOrderNum => $label) { - $this->assertEquals($label, $options[$optionOrderNum]->getLabel(), 'Label does not match expected.'); + $this->assertEquals( + $label, + $options[$optionOrderNum]->getLabel(), + "Label for option #{$optionOrderNum} does not match expected." + ); } } catch (LocalizedException $e) { $this->fail('Test failed with exception on attribute model load: ' . $e); } } + /** * Return translation for a string literal belonging to backend area * From c2a1f25dbc9f92d989111f88f851310bba504f3e Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko <skovalenko@magento.com> Date: Mon, 21 May 2018 18:21:25 +0300 Subject: [PATCH 039/133] MAGETWO-91608: SEO-friendly URL for category page not working --- .../Catalog/Controller/Adminhtml/Category.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index 13c4353e65204..1272043743688 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -3,8 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Catalog\Controller\Adminhtml; +use Magento\Store\Model\Store; + /** * Catalog category controller */ @@ -34,6 +38,22 @@ public function __construct( parent::__construct($context); } + /** + * Resolve store id + * + * Tries to take store id from store HTTP parameter, if can`t find it, try to dig into store_id + * If param is absent in store_id too, take default one + * @see Store + * + * @return int + */ + private function resolveStoreId() : int + { + $storeId = $this->getRequest()->getParam('store', false); + $storeId = $storeId === false ? $this->getRequest()->getParam('store_id', Store::DEFAULT_STORE_ID) : $storeId; + return (int) $storeId; + } + /** * Initialize requested category and put it into registry. * Root category can be returned, if inappropriate store/category is specified @@ -44,7 +64,7 @@ public function __construct( protected function _initCategory($getRootInstead = false) { $categoryId = $this->resolveCategoryId(); - $storeId = (int)$this->getRequest()->getParam('store'); + $storeId = $this->resolveStoreId(); $category = $this->_objectManager->create(\Magento\Catalog\Model\Category::class); $category->setStoreId($storeId); From a8da48564deac6acbafe2d143892ab6e5861e831 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko <skovalenko@magento.com> Date: Tue, 29 May 2018 11:52:22 +0300 Subject: [PATCH 040/133] MAGETWO-91608: SEO-friendly URL for category page not working --- app/code/Magento/Catalog/Controller/Adminhtml/Category.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index 1272043743688..88c371cb179f9 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -41,17 +41,14 @@ public function __construct( /** * Resolve store id * - * Tries to take store id from store HTTP parameter, if can`t find it, try to dig into store_id - * If param is absent in store_id too, take default one + * Tries to take store id from store HTTP parameter * @see Store * * @return int */ private function resolveStoreId() : int { - $storeId = $this->getRequest()->getParam('store', false); - $storeId = $storeId === false ? $this->getRequest()->getParam('store_id', Store::DEFAULT_STORE_ID) : $storeId; - return (int) $storeId; + return (int) $this->getRequest()->getParam('store_id', Store::DEFAULT_STORE_ID); } /** From 70949619f3af6a9db7c0c75eb975d1f207e2d611 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Tue, 5 Jun 2018 09:54:14 -0500 Subject: [PATCH 041/133] MC-141: Guest customer should be able to advance search grouped product with product name MC-146: Guest customer should be able to advance search grouped product with product sku MC-282: Guest customer should be able to advance search grouped product with product description MC-283: Guest customer should be able to advance search grouped product with product short description MC-284: Guest customer should be able to advance search grouped product with product price - added mftf tests --- .../Catalog/Metadata/product-meta.xml | 30 ++++ .../Catalog/Metadata/product_link-meta.xml | 12 +- .../Catalog/Metadata/product_links-meta.xml | 21 +++ .../Section/AdminProductContentSection.xml | 16 +++ ...AdvanceCatalogSearchGroupedProductTest.xml | 80 +++++++++++ .../Data/GroupedProductData.xml | 11 ++ .../GroupedProduct/Data/ProductLinkData.xml | 27 ++++ .../ProductLinkExtensionAttributeData.xml | 14 ++ .../GroupedProduct/Data/ProductLinksData.xml | 23 +++ ...AdvanceCatalogSearchGroupedProductTest.xml | 131 ++++++++++++++++++ 10 files changed, 359 insertions(+), 6 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_links-meta.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductContentSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchGroupedProductTest.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinkData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinkExtensionAttributeData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinksData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml index edbf1133d4fae..716737883c2eb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml @@ -118,4 +118,34 @@ <operation name="deleteProduct2" dataType="product2" type="delete" auth="adminOauth" url="/V1/products/{sku}" method="DELETE"> <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> </operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_link-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_link-meta.xml index a6d418dc675e7..899dc3a7f4a8c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_link-meta.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_link-meta.xml @@ -14,9 +14,9 @@ <field key="linked_product_sku">string</field> <field key="linked_product_type">string</field> <field key="position">integer</field> - <array key="extension_attributes"> - <value>product_link_extension_attribute</value> - </array> + <object key="extension_attributes" dataType="product_link_extension_attribute"> + <field key="qty">integer</field> + </object> </operation> <operation name="UpdateProductLink" dataType="product_link" type="update"> <field key="sku">string</field> @@ -24,8 +24,8 @@ <field key="linked_product_sku">string</field> <field key="linked_product_type">string</field> <field key="position">integer</field> - <array key="extension_attributes"> - <value>product_link_extension_attribute</value> - </array> + <object key="extension_attributes" dataType="product_link_extension_attribute"> + <field key="qty">integer</field> + </object> </operation> </operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_links-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_links-meta.xml new file mode 100644 index 0000000000000..34e8d0fca6833 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_links-meta.xml @@ -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="CreateProductLinks" dataType="product_links" type="create" auth="adminOauth" url="/V1/products/{sku}/links" method="POST"> + <contentType>application/json</contentType> + <array key="items"> + <value>product_link</value> + </array> + </operation> + <operation name="UpdateProductLinks" dataType="product_links" type="update" auth="adminOauth" url="/V1/products/{sku}/links" method="PUT"> + <contentType>application/json</contentType> + <field key="entity">product_link</field> + </operation> +</operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductContentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductContentSection.xml new file mode 100644 index 0000000000000..12a00ae8b3777 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductContentSection.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections 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="AdminProductContentSection"> + <element name="sectionHeader" type="button" selector="div[data-index='content']" timeout="30"/> + <element name="descriptionTextArea" type="textarea" selector="#product_form_description"/> + <element name="shortDescriptionTextArea" type="textarea" selector="#product_form_short_description"/> + </section> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchGroupedProductTest.xml new file mode 100644 index 0000000000000..aaba96848cb6c --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchGroupedProductTest.xml @@ -0,0 +1,80 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchGroupedProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product name"/> + <description value="Guest customer should be able to advance search Grouped product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-141"/> + <group value="CatalogSearch"/> + </annotations> + </test> + <test name="AdvanceCatalogSearchGroupedProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product sku"/> + <description value="Guest customer should be able to advance search Grouped product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-146"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> + <argument name="sku" value="$$createProductOne.sku$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchGroupedProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product description"/> + <description value="Guest customer should be able to advance search Grouped product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-282"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> + <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchGroupedProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product short description"/> + <description value="Guest customer should be able to advance search Grouped product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-283"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> + <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> + </actionGroup> + </test> + <test name="AdvanceCatalogSearchGroupedProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <features value="CatalogSearch"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product price"/> + <description value="Guest customer should be able to advance search Grouped product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-284"/> + <group value="CatalogSearch"/> + </annotations> + <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> + <argument name="name" value="$$createProductOne.name$$"/> + <argument name="priceFrom" value="$$simple1.price$$"/> + <argument name="priceTo" value="$$simple1.price$$"/> + </actionGroup> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/GroupedProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/GroupedProductData.xml index 019b0d24dec52..9960d698a7861 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/GroupedProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/GroupedProductData.xml @@ -17,4 +17,15 @@ <data key="urlKey" unique="suffix">groupedproduct</data> <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> </entity> + <entity name="ApiGroupedProduct" type="product3"> + <data key="sku" unique="suffix">api-grouped-product</data> + <data key="type_id">grouped</data> + <data key="attribute_set_id">4</data> + <data key="name" unique="suffix">Api Grouped Product</data> + <data key="status">1</data> + <data key="urlKey" unique="suffix">api-grouped-product</data> + <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> + <requiredEntity type="custom_attribute_array">ApiProductDescription</requiredEntity> + <requiredEntity type="custom_attribute_array">ApiProductShortDescription</requiredEntity> + </entity> </entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinkData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinkData.xml new file mode 100644 index 0000000000000..9a5df1e379a86 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinkData.xml @@ -0,0 +1,27 @@ +<?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="ProductLinkSimple1" type="product_link"> + <var key="sku" entityKey="sku" entityType="product3"/> + <var key="linked_product_sku" entityKey="sku" entityType="product"/> + <data key="link_type">associated</data> + <data key="linked_product_type">simple</data> + <data key="position">1</data> + <requiredEntity type="product_link_extension_attribute">Qty1000</requiredEntity> + </entity> + <entity name="ProductLinkSimple2" type="product_link"> + <var key="sku" entityKey="sku" entityType="product3"/> + <var key="linked_product_sku" entityKey="sku" entityType="product"/> + <data key="link_type">associated</data> + <data key="linked_product_type">simple</data> + <data key="position">2</data> + <requiredEntity type="product_link_extension_attribute">Qty1000</requiredEntity> + </entity> +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinkExtensionAttributeData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinkExtensionAttributeData.xml new file mode 100644 index 0000000000000..5f5dcb3a0ef4f --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinkExtensionAttributeData.xml @@ -0,0 +1,14 @@ +<?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="Qty1000" type="product_link_extension_attribute"> + <data key="qty">1000</data> + </entity> +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinksData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinksData.xml new file mode 100644 index 0000000000000..523517aa70080 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Data/ProductLinksData.xml @@ -0,0 +1,23 @@ +<?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="OneSimpleProductLink" type="product_links"> + <requiredEntity type="product_link">ProductLinkSimple1</requiredEntity> + </entity> + <entity name="OneMoreSimpleProductLink" type="product_links"> + <requiredEntity type="product_link">ProductLinkSimple2</requiredEntity> + </entity> + <entity name="TwoSimpleProductLinks" type="product_links"> + <array key="items"> + <item>ProductLinkSimple1</item> + <item>ProductLinkSimple2</item> + </array> + </entity> +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml new file mode 100644 index 0000000000000..9b11a76d16cd4 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml @@ -0,0 +1,131 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdvanceCatalogSearchGroupedProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="OneSimpleProductLink" stepKey="addProductOne"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple2"/> + </updateData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + </after> + </test> + <test name="AdvanceCatalogSearchGroupedProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="OneSimpleProductLink" stepKey="addProductOne"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple2"/> + </updateData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + </after> + </test> + <test name="AdvanceCatalogSearchGroupedProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="OneSimpleProductLink" stepKey="addProductOne"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple2"/> + </updateData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + </after> + </test> + <test name="AdvanceCatalogSearchGroupedProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="OneSimpleProductLink" stepKey="addProductOne"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple2"/> + </updateData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + </after> + </test> + <test name="AdvanceCatalogSearchGroupedProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <annotations> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> + <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="OneSimpleProductLink" stepKey="addProductOne"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple1"/> + </createData> + <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> + <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="simple2"/> + </updateData> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + </after> + </test> +</tests> From d3c682e101bc410107ebe9f200c2bb822ea73a83 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Tue, 5 Jun 2018 10:47:32 -0500 Subject: [PATCH 042/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - swatches fix --- .../Catalog/view/adminhtml/web/js/options.js | 5 ++-- .../Product/Attribute/Plugin/Save.php | 2 ++ .../adminhtml/web/js/product-attributes.js | 29 +++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index ce9dc4870b941..5f7ca36aace84 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -182,10 +182,9 @@ define([ } editForm.on('submit', function () { editForm - .find('input[name^="option"]') + .find('#manage-options-panel input[name^="option"]') .each(function() { optionsValues.push(this.name + '=' + jQuery(this).val()); - this.closest('tr').hide() }); jQuery('<input>') .attr({ @@ -193,7 +192,7 @@ define([ name: 'serialized_options' }) .val(JSON.stringify(optionsValues)) - .prependTo('#edit_form'); + .prependTo(editForm); optionPanel.find('table') .replaceWith(jQuery('<div>').text(jQuery.mage.__('Sending attribute values as package.'))); }); diff --git a/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php b/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php index dfda76372df1f..daf50e8b8e823 100644 --- a/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php +++ b/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php @@ -24,6 +24,8 @@ class Save public function beforeDispatch(Attribute\Save $subject, RequestInterface $request) { $data = $request->getPostValue(); + $data['serialized_options'] = $data['serialized_swatch_values']; + unset($data['serialized_swatch_values']); if (isset($data['frontend_input'])) { switch ($data['frontend_input']) { case 'swatch_visual': diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js index 1187e6bc4fdaa..0a0d024c2908e 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js @@ -414,6 +414,7 @@ define([ }; $(function () { + var editForm = $('#edit_form'); $('#frontend_input').bind('change', function () { swatchProductAttributes.bindAttributeInputType(); }); @@ -427,6 +428,34 @@ define([ $('.attribute-popup .collapse, [data-role="advanced_fieldset-content"]') .collapsable() .collapse('hide'); + + editForm.on('submit', function () { + var activePanel, + swatchValues = [], + swatchVisualPanel = $('#swatch-visual-options-panel'), + swatchTextPanel = $('#swatch-text-options-panel'); + + activePanel = swatchTextPanel.is(":visible") ? swatchTextPanel : swatchVisualPanel; + + activePanel + .find('table input') + .each(function() { + swatchValues.push(this.name + '=' + $(this).val()); + }); + + $('<input>') + .attr({ + type: 'hidden', + name: 'serialized_swatch_values' + }) + .val(JSON.stringify(swatchValues)) + .prependTo(editForm); + + [swatchVisualPanel, swatchTextPanel].forEach(function(el) { + $(el).find('table') + .replaceWith($('<div>').text($.mage.__('Sending swatch values as package.'))); + }); + }); }); window.saveAttributeInNewSet = swatchProductAttributes.saveAttributeInNewSet; From 8d275f7da3c1addbfb57481b371b1c45cce8b990 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Tue, 5 Jun 2018 14:56:33 -0500 Subject: [PATCH 043/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - swatches test --- .../Adminhtml/Product/Attribute/Save.php | 2 +- .../Product/Attribute/Plugin/Save.php | 8 +- .../Adminhtml/Product/AttributeTest.php | 1 + .../Adminhtml/Product/AttributeTest.php | 208 ++++++++++++++++++ 4 files changed, 216 insertions(+), 3 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 31c98af39c040..19337f8381316 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -333,7 +333,7 @@ private function extractOptionsData(&$data) foreach ($serializedOptions as $serializedOption) { $option = []; parse_str($serializedOption, $option); - $data = array_replace_recursive($data, $option); + $data = array_merge_recursive($data, $option); } } } diff --git a/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php b/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php index daf50e8b8e823..98691be5ef103 100644 --- a/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php +++ b/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php @@ -11,7 +11,7 @@ use Magento\Swatches\Model\Swatch; /** - * Class Save + * Plugin for product attribute save controller. */ class Save { @@ -24,7 +24,11 @@ class Save public function beforeDispatch(Attribute\Save $subject, RequestInterface $request) { $data = $request->getPostValue(); - $data['serialized_options'] = $data['serialized_swatch_values']; + //Data is serialized to overcome issues caused by max_input_vars value if it's modification is unavailable. + //See subject controller code and comments for more info. + if (isset($data['serialized_swatch_values'])) { + $data['serialized_options'] = $data['serialized_swatch_values']; + } unset($data['serialized_swatch_values']); if (isset($data['frontend_input'])) { switch ($data['frontend_input']) { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index c037e48758c85..4261873cc8e6e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ namespace Magento\Catalog\Controller\Adminhtml\Product; + use Magento\Framework\Exception\LocalizedException; /** diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php new file mode 100644 index 0000000000000..5d843ee236db5 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php @@ -0,0 +1,208 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Swatches\Controller\Adminhtml\Product; + +use Magento\Framework\Exception\LocalizedException; + +/** + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class AttributeTest extends \Magento\TestFramework\TestCase\AbstractBackendController +{ + /** + * Generate random hex color. + * + * @return string + */ + private function getRandomColor() + { + return '#' . str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT); + } + + /** + * Get visual swatches data set. + * + * @param int $optionsCount + * @return array + */ + private function getSwatchVisualDataSet($optionsCount) + { + $optionsData = []; + $expectedOptionsLabels = []; + for ($i = 0; $i < $optionsCount; $i++) { + $order = $i + 1; + $expectedOptionLabelOnStoreView = "value_{$i}_store_1"; + $expectedOptionsLabels[$i+1] = $expectedOptionLabelOnStoreView; + $optionsData []= "optionvisual[order][option_{$i}]={$order}"; + $optionsData []= "defaultvisual[]=option_{$i}"; + $optionsData []= "swatchvisual[value][option_{$i}]={$this->getRandomColor()}"; + $optionsData []= "optionvisual[value][option_{$i}][0]=value_{$i}_admin"; + $optionsData []= "optionvisual[value][option_{$i}][1]={$expectedOptionLabelOnStoreView}"; + $optionsData []= "optionvisual[delete][option_{$i}]="; + } + $optionsData []= "visual_swatch_validation="; + $optionsData []= "visual_swatch_validation_unique="; + return [ + 'attribute_data' => array_merge_recursive( + [ + 'serialized_swatch_values' => json_encode($optionsData), + ], + $this->getAttributePreset(), + [ + 'frontend_input' => 'swatch_visual' + ] + ), + 'expected_options_count' => $optionsCount + 1, + 'expected_store_labels' => $expectedOptionsLabels + ]; + } + + /** + * Get text swatches data set. + * + * @param int $optionsCount + * @return array + */ + private function getSwatchTextDataSet($optionsCount) + { + $optionsData = []; + $expectedOptionsLabels = []; + for ($i = 0; $i < $optionsCount; $i++) { + $order = $i + 1; + $expectedOptionLabelOnStoreView = "value_{$i}_store_1"; + $expectedOptionsLabels[$i+1] = $expectedOptionLabelOnStoreView; + $optionsData []= "optiontext[order][option_{$i}]={$order}"; + $optionsData []= "defaulttext[]=option_{$i}"; + $optionsData []= "swatchtext[value][option_{$i}]=x{$i}"; + $optionsData []= "optiontext[value][option_{$i}][0]=value_{$i}_admin"; + $optionsData []= "optiontext[value][option_{$i}][1]={$expectedOptionLabelOnStoreView}"; + $optionsData []= "optiontext[delete][option_{$i}]="; + } + $optionsData []= "text_swatch_validation="; + $optionsData []= "text_swatch_validation_unique="; + return [ + 'attribute_data' => array_merge_recursive( + [ + 'serialized_swatch_values' => json_encode($optionsData), + ], + $this->getAttributePreset(), + [ + 'frontend_input' => 'swatch_text' + ] + ), + 'expected_options_count' => $optionsCount + 1, + 'expected_store_labels' => $expectedOptionsLabels + ]; + } + + // ["optiontext[order][option_0]=1","defaulttext[]=option_0","swatchtext[value][option_0][0]=1","optiontext[value][option_0][0]=111","swatchtext[value][option_0][1]=1","optiontext[value][option_0][1]=111","swatchtext[value][option_0][2]=","optiontext[value][option_0][2]=","optiontext[delete][option_0]=","optiontext[order][option_1]=2","defaulttext[]=option_1","swatchtext[value][option_1][0]=2","optiontext[value][option_1][0]=222","swatchtext[value][option_1][1]=2","optiontext[value][option_1][1]=222","swatchtext[value][option_1][2]=","optiontext[value][option_1][2]=","optiontext[delete][option_1]=","text_swatch_validation=","text_swatch_validation_unique="] + + /** + * Get data preset for new attribute. + * + * @return array + */ + private function getAttributePreset() + { + return [ + 'serialized_options' => '[]', + 'form_key' => 'XxtpPYjm2YPYUlAt', + 'frontend_label' => [ + 0 => 'asdasd', + 1 => '', + 2 => '', + ], + 'is_required' => '0', + 'update_product_preview_image' => '0', + 'use_product_image_for_swatch' => '0', + 'is_global' => '0', + 'default_value_text' => '512', + 'default_value_yesno' => '1', + 'default_value_date' => '1/1/70', + 'default_value_textarea' => '512', + 'is_unique' => '0', + 'is_used_in_grid' => '1', + 'is_visible_in_grid' => '1', + 'is_filterable_in_grid' => '1', + 'is_searchable' => '0', + 'is_comparable' => '0', + 'is_filterable' => '0', + 'is_filterable_in_search' => '0', + 'position' => '0', + 'is_used_for_promo_rules' => '0', + 'is_html_allowed_on_front' => '1', + 'is_visible_on_front' => '0', + 'used_in_product_listing' => '0', + 'used_for_sort_by' => '0', + 'attribute_code' => 'test_many_swatches', + ]; + } + + /** + * Data provider for large swatches amount test. + * + * @return array + */ + public function getLargeSwatchesAmountAttributeData() + { + $maxInputVars = ini_get('max_input_vars'); + // Each option is at least 7 variables array for a visual swatch. + // Set options count to exceed max_input_vars by 20 options (140 variables). + $swatchVisualOptionsCount = floor($maxInputVars / 7) + 20; + $swatchTextOptionsCount = floor($maxInputVars / 4) + 80; + return [ + 'visual swatches' => $this->getSwatchVisualDataSet($swatchVisualOptionsCount), + 'text swatches' => $this->getSwatchTextDataSet($swatchTextOptionsCount) + ]; + } + + /** + * Test attribute saving with large amount of options exceeding maximum allowed by max_input_vars limit. + * @dataProvider getLargeSwatchesAmountAttributeData() + * @param array $attributeData + * @param int $expectedOptionsCount + * @param array $expectedLabels + * @return void + */ + public function testLargeOptionsDataSet($attributeData, $expectedOptionsCount, $expectedLabels) + { + $this->getRequest()->setPostValue($attributeData); + $this->dispatch('backend/catalog/product_attribute/save'); + $entityTypeId = $this->_objectManager->create( + \Magento\Eav\Model\Entity::class + )->setType( + \Magento\Catalog\Model\Product::ENTITY + )->getTypeId(); + + /** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */ + $attribute = $this->_objectManager->create( + \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class + )->setEntityTypeId( + $entityTypeId + ); + try { + $attribute->loadByCode($entityTypeId, 'test_many_swatches'); + $options = $attribute->getOptions(); + // assert that all options are saved without truncation + $this->assertEquals( + $expectedOptionsCount, + count($options), + 'Expected options count does not match (regarding first empty option for non-required attribute)' + ); + + foreach ($expectedLabels as $optionOrderNum => $label) { + $this->assertEquals( + $label, + $options[$optionOrderNum]->getLabel(), + "Label for option #{$optionOrderNum} does not match expected." + ); + } + } catch (LocalizedException $e) { + $this->fail('Test failed with exception on attribute model load: ' . $e); + } + } +} From 89052b6d1b40a54ce0238b38ef549e48c5ecb84a Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Tue, 5 Jun 2018 14:58:04 -0500 Subject: [PATCH 044/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - swatches test --- .../Catalog/Controller/Adminhtml/Product/Attribute/Save.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 19337f8381316..36e7bda523bd4 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -319,6 +319,7 @@ public function execute() /** * Extract options data from serialized options field. + * * This logic is required to overcome max_input_vars php limit * that may vary and/or be inaccessible to change on different instances. * From f3d5e733b4935b2322cc49fec6c65ced884ef9c0 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Tue, 5 Jun 2018 15:00:04 -0500 Subject: [PATCH 045/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - swatches test --- .../Catalog/Controller/Adminhtml/Product/Attribute/Save.php | 2 +- .../Swatches/Controller/Adminhtml/Product/AttributeTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 36e7bda523bd4..d78b6aaf45cfd 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -319,7 +319,7 @@ public function execute() /** * Extract options data from serialized options field. - * + * * This logic is required to overcome max_input_vars php limit * that may vary and/or be inaccessible to change on different instances. * diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php index 5d843ee236db5..20c791b9c6268 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php @@ -8,6 +8,8 @@ use Magento\Framework\Exception\LocalizedException; /** + * Test for product attribute save controller. + * * @magentoAppArea adminhtml * @magentoDbIsolation enabled */ @@ -99,8 +101,6 @@ private function getSwatchTextDataSet($optionsCount) ]; } - // ["optiontext[order][option_0]=1","defaulttext[]=option_0","swatchtext[value][option_0][0]=1","optiontext[value][option_0][0]=111","swatchtext[value][option_0][1]=1","optiontext[value][option_0][1]=111","swatchtext[value][option_0][2]=","optiontext[value][option_0][2]=","optiontext[delete][option_0]=","optiontext[order][option_1]=2","defaulttext[]=option_1","swatchtext[value][option_1][0]=2","optiontext[value][option_1][0]=222","swatchtext[value][option_1][1]=2","optiontext[value][option_1][1]=222","swatchtext[value][option_1][2]=","optiontext[value][option_1][2]=","optiontext[delete][option_1]=","text_swatch_validation=","text_swatch_validation_unique="] - /** * Get data preset for new attribute. * From ef2c07952c05104388b713d6ba743dac36166846 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Tue, 5 Jun 2018 15:47:20 -0500 Subject: [PATCH 046/133] MC-181: Configurable Product goes "Out of Stock" if all associated Simple Products are "Out of Stock" --- .../Data/ProductExtensionAttributeData.xml | 3 + .../Catalog/Data/StockItemData.xml | 4 + .../Data/SimpleProductData.xml | 37 ++++++++ .../StorefrontProductInfoMainSection.xml | 1 + ...AdminConfigurableProductOutOfStockTest.xml | 93 +++++++++++++++++++ 5 files changed, 138 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/SimpleProductData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductExtensionAttributeData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductExtensionAttributeData.xml index 39cd17effeffc..b45dd1ccbcd0f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductExtensionAttributeData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductExtensionAttributeData.xml @@ -11,4 +11,7 @@ <entity name="EavStockItem" type="product_extension_attribute"> <requiredEntity type="stock_item">Qty_1000</requiredEntity> </entity> + <entity name="NoStockItem" type="product_extension_attribute"> + <requiredEntity type="stock_item">Qty_0</requiredEntity> + </entity> </entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StockItemData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StockItemData.xml index d76370d4ea0d2..14ac7207d4586 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StockItemData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StockItemData.xml @@ -12,4 +12,8 @@ <data key="qty">1000</data> <data key="is_in_stock">true</data> </entity> + <entity name="Qty_0" type="stock_item"> + <data key="qty">0</data> + <data key="is_in_stock">false</data> + </entity> </entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/SimpleProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/SimpleProductData.xml new file mode 100644 index 0000000000000..0557379aa4cfd --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/SimpleProductData.xml @@ -0,0 +1,37 @@ +<?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="ApiSimpleProductNoQuantityOne" type="product2"> + <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">123.00</data> + <data key="urlKey" unique="suffix">api-simple-product</data> + <data key="status">1</data> + <data key="quantity">0</data> + <requiredEntity type="product_extension_attribute">NoStockItem</requiredEntity> + <requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity> + </entity> + <entity name="ApiSimpleProductNoQuantityTwo" type="product2"> + <data key="sku" unique="suffix">api-simple-product-two</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 Two</data> + <data key="price">234.00</data> + <data key="urlKey" unique="suffix">api-simple-product-two</data> + <data key="status">1</data> + <data key="quantity">0</data> + <requiredEntity type="product_extension_attribute">NoStockItem</requiredEntity> + <requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity> + </entity> +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml index cebb76e68a6cc..4a1b75289f215 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml @@ -14,5 +14,6 @@ <element name="productAttributeOptions1" type="select" selector="#product-options-wrapper div[tabindex='0'] option"/> <element name="productAttributeOptionsSelectButton" type="select" selector="#product-options-wrapper .super-attribute-select"/> <element name="productAttributeOptionsError" type="text" selector="//div[@class='mage-error']"/> + <element name="outOfStockError" type="block" selector=".unavailable" /> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml new file mode 100644 index 0000000000000..50a28fc6d02ef --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml @@ -0,0 +1,93 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminConfigurableProductOutOfStockTest"> + <annotations> + <features value="ConfigurableProduct"/> + <stories value="Out Of Stock"/> + <title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> + <description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> + <testCaseId value="MC-181"/> + <group value="LeviTest"/> + </annotations> + <before> + <!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. --> + <!-- Create the category to put the product in --> + <createData entity="ApiCategory" stepKey="createCategory"/> + + <!-- Create the configurable product based on the data in the /data folder --> + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + + <!-- Make the configurable product have two options, that are children of the default attribute set --> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Create the 2 children that will be a part of the configurable product --> + <createData entity="ApiSimpleProductNoQuantityOne" stepKey="createConfigChildProduct1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + </createData> + <createData entity="ApiSimpleProductNoQuantityTwo" stepKey="createConfigChildProduct2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + + <!-- Assign the two products to the configurable product --> + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct1"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct2"/> + </createData> + + <!-- log in --> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + + <after> + <amOnPage url="admin/admin/auth/logout/" stepKey="logout"/> + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + </after> + <!-- ADD TEST STEPS HERE --> + + <!-- Check to make sure that the configurable product shows up as out of stock --> + <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage" /> + <waitForPageLoad stepKey="waitForStoreFrontLoad" /> + <see stepKey="lookForOutOfStock" selector="{{StorefrontProductInfoMainSection.outOfStockError}}" userInput="OUT OF STOCK" /> + </test> +</tests> From 51f72c4bd8644b003fcfb676f85147e9839b96a4 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Tue, 5 Jun 2018 16:49:41 -0500 Subject: [PATCH 047/133] MC-181: Configurable Product goes "Out of Stock" if all associated Simple Products are "Out of Stock" - Delete created items in the correct order --- .../Test/AdminConfigurableProductOutOfStockTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml index 50a28fc6d02ef..2539f6e8bd554 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml @@ -15,7 +15,7 @@ <title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> <description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> <testCaseId value="MC-181"/> - <group value="LeviTest"/> + <group value="ConfigurableProduct"/> </annotations> <before> <!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. --> @@ -77,10 +77,10 @@ <after> <amOnPage url="admin/admin/auth/logout/" stepKey="logout"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> - <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> </after> <!-- ADD TEST STEPS HERE --> From c257b807fe2d8d877020847db782818233ee9dd8 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Tue, 5 Jun 2018 17:03:02 -0500 Subject: [PATCH 048/133] MC-235: Customer should only see cart price rule discount if condition subtotal equals or greater than - Use an action group that can be merged from b2b --- .../ActionGroup/AdminCartPriceRuleActionGroup.xml | 14 ++++++++++++++ .../Test/StorefrontCartPriceRuleCountry.xml | 2 +- .../Test/StorefrontCartPriceRulePostcode.xml | 2 +- .../Test/StorefrontCartPriceRuleQuantity.xml | 2 +- .../Test/StorefrontCartPriceRuleState.xml | 2 +- .../Test/StorefrontCartPriceRuleSubtotal.xml | 2 +- 6 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/AdminCartPriceRuleActionGroup.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/AdminCartPriceRuleActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/AdminCartPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..24d881ee6081d --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/ActionGroup/AdminCartPriceRuleActionGroup.xml @@ -0,0 +1,14 @@ +<?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="selectNotLoggedInCustomerGroup"> + <!-- This actionGroup was created to be merged from B2B because B2B has a very different form control here --> + <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + </actionGroup> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleCountry.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleCountry.xml index 0f7bf3d9eaf33..a6a0d669f3435 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleCountry.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleCountry.xml @@ -42,7 +42,7 @@ <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> <!-- Scroll down to fix some flaky behavior... --> <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRulePostcode.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRulePostcode.xml index 1d8aba54f3675..97936382e60e0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRulePostcode.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRulePostcode.xml @@ -42,7 +42,7 @@ <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> <!-- Scroll down to fix some flaky behavior... --> <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml index 4c206776a676d..f4342b5d480b4 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleQuantity.xml @@ -42,7 +42,7 @@ <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> <!-- Scroll down to fix some flaky behavior... --> <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml index 13238b507393a..e2de2117d78e7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleState.xml @@ -42,7 +42,7 @@ <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> <!-- Scroll down to fix some flaky behavior... --> <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml index 0f3a1568d0fef..6c49534ee43c1 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SalesRule/Test/StorefrontCartPriceRuleSubtotal.xml @@ -42,7 +42,7 @@ <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.customerGroups}}" userInput="NOT LOGGED IN" stepKey="selectCustomerGroup"/> + <actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/> <click selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="expandConditions"/> <!-- Scroll down to fix some flaky behavior... --> <scrollTo selector="{{PriceRuleConditionsSection.conditionsTab}}" stepKey="scrollToConditionsTab"/> From b5a2e0e45536bc772b136d9505410f5ddcec9993 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@transoftgroup.com> Date: Wed, 6 Jun 2018 08:19:04 +0300 Subject: [PATCH 049/133] MAGETWO-92137: Refreshing page deletes shipping address on guest checkout if module-persistent is enabled --- .../CheckExpirePersistentQuoteObserver.php | 43 +++++++- ...CheckExpirePersistentQuoteObserverTest.php | 104 ++++++++++++++++-- .../AddProductToCartActionGroup.xml | 1 + .../NavigateToCheckoutActionGroup.xml | 16 +++ .../GuestCheckoutReviewAndPaymentsPage.xml | 14 +++ .../Section/GuestCheckoutPaymentSection.xml | 18 +++ .../Section/GuestCheckoutShippingSection.xml | 23 ++++ .../Checkout/Section/PaymentMethodSection.xml | 14 +++ .../Checkout/Section/ShipToSection.xml | 14 +++ .../Persistent/Data/PersistentData.xml | 23 ++++ .../Metadata/persistent_config-meta.xml | 21 ++++ ...GuestCheckoutWithEnabledPersistentTest.xml | 85 ++++++++++++++ 12 files changed, 361 insertions(+), 15 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/NavigateToCheckoutActionGroup.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutPaymentSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutShippingSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/PaymentMethodSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/ShipToSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Data/PersistentData.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Metadata/persistent_config-meta.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml diff --git a/app/code/Magento/Persistent/Observer/CheckExpirePersistentQuoteObserver.php b/app/code/Magento/Persistent/Observer/CheckExpirePersistentQuoteObserver.php index 2aaf0f30fe71d..f3720960ca6e5 100644 --- a/app/code/Magento/Persistent/Observer/CheckExpirePersistentQuoteObserver.php +++ b/app/code/Magento/Persistent/Observer/CheckExpirePersistentQuoteObserver.php @@ -50,6 +50,20 @@ class CheckExpirePersistentQuoteObserver implements ObserverInterface */ protected $_persistentData = null; + /** + * Request + * + * @var \Magento\Framework\App\RequestInterface + */ + private $request; + + /** + * Checkout Page path + * + * @var string + */ + private $checkoutPagePath = 'checkout'; + /** * @param \Magento\Persistent\Helper\Session $persistentSession * @param \Magento\Persistent\Helper\Data $persistentData @@ -57,6 +71,7 @@ class CheckExpirePersistentQuoteObserver implements ObserverInterface * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Framework\App\RequestInterface $request */ public function __construct( \Magento\Persistent\Helper\Session $persistentSession, @@ -64,7 +79,8 @@ public function __construct( \Magento\Persistent\Model\QuoteManager $quoteManager, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Customer\Model\Session $customerSession, - \Magento\Checkout\Model\Session $checkoutSession + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Framework\App\RequestInterface $request ) { $this->_persistentSession = $persistentSession; $this->quoteManager = $quoteManager; @@ -72,6 +88,7 @@ public function __construct( $this->_checkoutSession = $checkoutSession; $this->_eventManager = $eventManager; $this->_persistentData = $persistentData; + $this->request = $request; } /** @@ -90,12 +107,32 @@ public function execute(\Magento\Framework\Event\Observer $observer) !$this->_persistentSession->isPersistent() && !$this->_customerSession->isLoggedIn() && $this->_checkoutSession->getQuoteId() && - !$observer->getControllerAction() instanceof \Magento\Checkout\Controller\Onepage - // persistent session does not expire on onepage checkout page to not spoil customer group id + !$this->isRequestFromCheckoutPage($this->request) + // persistent session does not expire on onepage checkout page ) { $this->_eventManager->dispatch('persistent_session_expired'); $this->quoteManager->expire(); $this->_customerSession->setCustomerId(null)->setCustomerGroupId(null); } } + + /** + * Check current request is coming from onepage checkout page. + * + * @param \Magento\Framework\App\RequestInterface $request + * @return bool + */ + private function isRequestFromCheckoutPage(\Magento\Framework\App\RequestInterface $request): bool + { + $requestUri = (string)$request->getRequestUri(); + $refererUri = (string)$request->getServer('HTTP_REFERER'); + + /** @var bool $isCheckoutPage */ + $isCheckoutPage = ( + false !== strpos($requestUri, $this->checkoutPagePath) || + false !== strpos($refererUri, $this->checkoutPagePath) + ); + + return $isCheckoutPage; + } } diff --git a/app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php b/app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php index a52e22a960e0b..366034c8a3e4f 100644 --- a/app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php @@ -49,24 +49,39 @@ class CheckExpirePersistentQuoteObserverTest extends \PHPUnit\Framework\TestCase */ protected $eventManagerMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface + */ + private $requestMock; + + /** + * @inheritdoc + */ protected function setUp() { $this->sessionMock = $this->createMock(\Magento\Persistent\Helper\Session::class); $this->customerSessionMock = $this->createMock(\Magento\Customer\Model\Session::class); $this->persistentHelperMock = $this->createMock(\Magento\Persistent\Helper\Data::class); - $this->observerMock - = $this->createPartialMock(\Magento\Framework\Event\Observer::class, ['getControllerAction', - '__wakeUp']); + $this->observerMock = $this->createPartialMock( + \Magento\Framework\Event\Observer::class, + ['getControllerAction','__wakeUp'] + ); $this->quoteManagerMock = $this->createMock(\Magento\Persistent\Model\QuoteManager::class); $this->eventManagerMock = $this->createMock(\Magento\Framework\Event\ManagerInterface::class); $this->checkoutSessionMock = $this->createMock(\Magento\Checkout\Model\Session::class); + $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class) + ->disableOriginalConstructor() + ->setMethods(['getRequestUri', 'getServer']) + ->getMockForAbstractClass(); + $this->model = new \Magento\Persistent\Observer\CheckExpirePersistentQuoteObserver( $this->sessionMock, $this->persistentHelperMock, $this->quoteManagerMock, $this->eventManagerMock, $this->customerSessionMock, - $this->checkoutSessionMock + $this->checkoutSessionMock, + $this->requestMock ); } @@ -93,8 +108,23 @@ public function testExecuteWhenPersistentIsNotEnabled() $this->model->execute($this->observerMock); } - public function testExecuteWhenPersistentIsEnabled() - { + /** + * Test method \Magento\Persistent\Observer\CheckExpirePersistentQuoteObserver::execute when persistent is enabled. + * + * @param string $refererUri + * @param string $requestUri + * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expireCounter + * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $dispatchCounter + * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $setCustomerIdCounter + * @dataProvider requestDataProvider + */ + public function testExecuteWhenPersistentIsEnabled( + string $refererUri, + string $requestUri, + \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expireCounter, + \PHPUnit_Framework_MockObject_Matcher_InvokedCount $dispatchCounter, + \PHPUnit_Framework_MockObject_Matcher_InvokedCount $setCustomerIdCounter + ) { $this->persistentHelperMock ->expects($this->once()) ->method('canProcess') @@ -102,16 +132,66 @@ public function testExecuteWhenPersistentIsEnabled() ->will($this->returnValue(true)); $this->persistentHelperMock->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); $this->sessionMock->expects($this->once())->method('isPersistent')->will($this->returnValue(false)); - $this->customerSessionMock->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false)); - $this->checkoutSessionMock->expects($this->once())->method('getQuoteId')->will($this->returnValue(10)); - $this->observerMock->expects($this->once())->method('getControllerAction'); - $this->eventManagerMock->expects($this->once())->method('dispatch'); - $this->quoteManagerMock->expects($this->once())->method('expire'); $this->customerSessionMock - ->expects($this->once()) + ->expects($this->atLeastOnce()) + ->method('isLoggedIn') + ->will($this->returnValue(false)); + $this->checkoutSessionMock + ->expects($this->atLeastOnce()) + ->method('getQuoteId') + ->will($this->returnValue(10)); + $this->eventManagerMock->expects($dispatchCounter)->method('dispatch'); + $this->quoteManagerMock->expects($expireCounter)->method('expire'); + $this->customerSessionMock + ->expects($setCustomerIdCounter) ->method('setCustomerId') ->with(null) ->will($this->returnSelf()); + $this->requestMock->expects($this->atLeastOnce())->method('getRequestUri')->willReturn($refererUri); + $this->requestMock + ->expects($this->atLeastOnce()) + ->method('getServer') + ->with('HTTP_REFERER') + ->willReturn($requestUri); $this->model->execute($this->observerMock); } + + /** + * Request Data Provider + * + * @return array + */ + public function requestDataProvider() + { + return [ + [ + 'refererUri' => 'checkout', + 'requestUri' => 'index', + 'expireCounter' => $this->never(), + 'dispatchCounter' => $this->never(), + 'setCustomerIdCounter' => $this->never(), + ], + [ + 'refererUri' => 'checkout', + 'requestUri' => 'checkout', + 'expireCounter' => $this->never(), + 'dispatchCounter' => $this->never(), + 'setCustomerIdCounter' => $this->never(), + ], + [ + 'refererUri' => 'index', + 'requestUri' => 'checkout', + 'expireCounter' => $this->never(), + 'dispatchCounter' => $this->never(), + 'setCustomerIdCounter' => $this->never(), + ], + [ + 'refererUri' => 'index', + 'requestUri' => 'index', + 'expireCounter' => $this->once(), + 'dispatchCounter' => $this->once(), + 'setCustomerIdCounter' => $this->once(), + ], + ]; + } } diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AddProductToCartActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AddProductToCartActionGroup.xml index 6caa4fef770b1..9380c3052a5f5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AddProductToCartActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AddProductToCartActionGroup.xml @@ -14,5 +14,6 @@ <amOnPage url="/{{product.name}}.html" stepKey="navigateProductPage"/> <click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/> <waitForElementVisible selector="{{StorefrontProductPageSection.successMsg}}" time="30" stepKey="waitForProductAdded"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added {{product.name}} to your shopping cart." stepKey="seeAddedToCartMessage"/> </actionGroup> </actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/NavigateToCheckoutActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/NavigateToCheckoutActionGroup.xml new file mode 100644 index 0000000000000..94c70e9846814 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/NavigateToCheckoutActionGroup.xml @@ -0,0 +1,16 @@ +<?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="NavigateToCheckoutActionGroup"> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + <!--<waitForPageLoad stepKey="waitForPageLoad2"/>--> + </actionGroup> +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml new file mode 100644 index 0000000000000..15124da1f35da --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml @@ -0,0 +1,14 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd"> + <page name="GuestCheckoutPage" url="/checkout/#payment" area="storefront" module="Checkout"> + <section name="PaymentMethodSection"/> + <section name="ShipToSection"/> + </page> +</pages> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutPaymentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutPaymentSection.xml new file mode 100644 index 0000000000000..ef633e5470958 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutPaymentSection.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections 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="GuestCheckoutPaymentSection"> + <!--<element name="cartItemsArea" type="textarea" selector=".items-in-cart"/>--> + <!--<element name="cartItemsAreaActive" type="textarea" selector="div.block.items-in-cart.active"/>--> + <!--<element name="cartItems" type="text" selector=".minicart-items"/>--> + <!--<element name="billingAddress" type="text" selector="div.billing-address-details"/>--> + <element name="placeOrder" type="button" selector="button.action.primary.checkout" timeout="30"/> + </section> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutShippingSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutShippingSection.xml new file mode 100644 index 0000000000000..0af05846f4b54 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutShippingSection.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections 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="GuestCheckoutShippingSection"> + <element name="email" type="input" selector="#customer-email"/> + <element name="firstName" type="input" selector="input[name=firstname]"/> + <element name="lastName" type="input" selector="input[name=lastname]"/> + <element name="street" type="input" selector="input[name='street[0]']"/> + <element name="city" type="input" selector="input[name=city]"/> + <element name="region" type="select" selector="select[name=region_id]"/> + <element name="postcode" type="input" selector="input[name=postcode]"/> + <element name="telephone" type="input" selector="input[name=telephone]"/> + <element name="next" type="button" selector="button.button.action.continue.primary"/> + <element name="firstShippingMethod" type="radio" selector=".row:nth-of-type(1) .col-method .radio"/> + </section> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/PaymentMethodSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/PaymentMethodSection.xml new file mode 100644 index 0000000000000..a12302f4436bd --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/PaymentMethodSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections 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="PaymentMethodSection"> + <element name="billingAddress" type="text" selector=".checkout-billing-address"/> + </section> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/ShipToSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/ShipToSection.xml new file mode 100644 index 0000000000000..344c39d0c35ec --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/ShipToSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections 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="ShipToSection"> + <element name="shippingInformation" type="text" selector=".shipping-information-content"/> + </section> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Data/PersistentData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Data/PersistentData.xml new file mode 100644 index 0000000000000..4ba2e1ae73824 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Data/PersistentData.xml @@ -0,0 +1,23 @@ +<?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="PersistentConfigDefault" type="persistent_config_state"> + <requiredEntity type="persistent_options_enabled">persistentDefaultState</requiredEntity> + </entity> + <entity name="persistentDefaultState" type="persistent_options_enabled"> + <data key="value">0</data> + </entity> + + <entity name="PersistentConfigEnabled" type="persistent_config_state"> + <requiredEntity type="persistent_options_enabled">persistentEnabledState</requiredEntity> + </entity> + <entity name="persistentEnabledState" type="persistent_options_enabled"> + <data key="value">1</data> + </entity> +</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Metadata/persistent_config-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Metadata/persistent_config-meta.xml new file mode 100644 index 0000000000000..69a835aa703eb --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Metadata/persistent_config-meta.xml @@ -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="CreatePersistentConfigState" dataType="persistent_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/persistent/" method="POST"> + <object key="groups" dataType="persistent_config_state"> + <object key="options" dataType="persistent_config_state"> + <object key="fields" dataType="persistent_config_state"> + <object key="enabled" dataType="persistent_options_enabled"> + <field key="value">string</field> + </object> + </object> + </object> + </object> + </operation> +</operations> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml new file mode 100644 index 0000000000000..fa50738bf5819 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml @@ -0,0 +1,85 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="GuestCheckoutWithEnabledPersistentTest"> + <annotations> + <features value="Persistent"/> + <title value="Guest Checkout with Enabled Persistent"/> + <description value="Checkout data must be restored after page checkout reload."/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-92453"/> + <group value="persistent"/> + </annotations> + <before> + <createData entity="PersistentConfigEnabled" stepKey="enablePersistent"/> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <createData entity="PersistentConfigDefault" stepKey="setDefaultPersistentState"/> + <actionGroup ref="logout" stepKey="adminLogout"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + </after> + <!-- Add simple product to cart --> + <actionGroup stepKey="addProductToCart1" ref="AddSimpleProductToCart"> + <argument name="product" value="$$createProduct$$"/> + </actionGroup> + <!-- Navigate to checkout --> + <actionGroup stepKey="addProductNavigateToCheckout" ref="NavigateToCheckoutActionGroup"/> + <!-- Fill Shipping Address form --> + <fillField selector="{{GuestCheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> + <fillField selector="{{GuestCheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{GuestCheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{GuestCheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{GuestCheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> + <selectOption selector="{{GuestCheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> + <fillField selector="{{GuestCheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{GuestCheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <click selector="{{GuestCheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <!-- Check that have the same values after page reload --> + <amOnPage url="{{CheckoutPage.url}}" stepKey="amOnCheckoutPage2"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> + <seeInField stepKey="seeEmailtOnCheckout" selector="{{GuestCheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" /> + <seeInField stepKey="seeFirstnameOnCheckout" selector="{{GuestCheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstName}}" /> + <seeInField stepKey="seeLastnameOnCheckout" selector="{{GuestCheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastName}}" /> + <seeInField stepKey="seeStreetOnCheckout" selector="{{GuestCheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" /> + <seeInField stepKey="seeCityOnCheckout" selector="{{GuestCheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" /> + <seeInField stepKey="seeStateOnCheckout" selector="{{GuestCheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" /> + <seeInField stepKey="seePostcodeOnCheckout" selector="{{GuestCheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" /> + <seeInField stepKey="seePhoneOnCheckout" selector="{{GuestCheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" /> + <waitForElement selector="{{GuestCheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <!-- Click next button to open payment section --> + <click selector="{{GuestCheckoutShippingSection.next}}" stepKey="clickNext"/> + <waitForElement selector="{{GuestCheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> + <!-- Reload payment section --> + <amOnPage url="{{GuestCheckoutPage.url}}" stepKey="amOnCheckoutShipToPage"/> + <waitForElement selector="{{GuestCheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton2"/> + <!-- Check that address block contains correct information --> + <see stepKey="seeBilllingFirstName" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.firstName}}" /> + <see stepKey="seeBilllingLastName" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.lastName}}" /> + <see stepKey="seeBilllingStreet" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" /> + <see stepKey="seeBilllingCity" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.city}}" /> + <see stepKey="seeBilllingState" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.state}}" /> + <see stepKey="seeBilllingPostcode" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.postcode}}" /> + <see stepKey="seeBilllingTelephone" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.telephone}}" /> + <!-- Check that "Ship To" block contains correct information --> + <see stepKey="seeShipToFirstName" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.firstName}}" /> + <see stepKey="seeShipToLastName" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.lastName}}" /> + <see stepKey="seeShipToStreet" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.street[0]}}" /> + <see stepKey="seeShipToCity" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.city}}" /> + <see stepKey="seeShipToState" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.state}}" /> + <see stepKey="seeShipToPostcode" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.postcode}}" /> + <see stepKey="seeShipToTelephone" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.telephone}}" /> + </test> +</tests> From 172e5ae2b2357d6ccd4f848d866b8bee7405d56c Mon Sep 17 00:00:00 2001 From: hitesh-wagento <hitesh@wagento.com> Date: Wed, 6 Jun 2018 11:22:23 +0530 Subject: [PATCH 050/133] --- .../Magento_Catalog/web/css/source/module/_toolbar.less | 7 +++---- .../Magento_Catalog/web/css/source/module/_toolbar.less | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less index a0bd5e695a621..0f335b37879c7 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less @@ -188,10 +188,9 @@ .lib-icon-font-symbol(@icon-list); } - .limiter { - float: right; - - .products.wrapper ~ .toolbar & { + .toolbar { + .products.wrapper ~ & .limiter { + float: right; display: block; } } diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less index 580abf264cadc..ef4c119dd60b0 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less @@ -233,9 +233,9 @@ } } - .limiter { - float: right; - .products.wrapper ~ .toolbar & { + .toolbar { + .products.wrapper ~ & .limiter { + float: right; display: block; } } From c44f1f84d274ff9324742831e09f0b7f49027a7b Mon Sep 17 00:00:00 2001 From: Piyush Dankhara <dankhrapiyush@gmail.com> Date: Wed, 6 Jun 2018 00:53:10 -0700 Subject: [PATCH 051/133] [Forwardport 2.3] Trim username on customer account login page --- .../view/frontend/templates/form/login.phtml | 10 +++ .../view/frontend/web/js/trim-username.js | 65 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 app/code/Magento/Customer/view/frontend/web/js/trim-username.js diff --git a/app/code/Magento/Customer/view/frontend/templates/form/login.phtml b/app/code/Magento/Customer/view/frontend/templates/form/login.phtml index 16206525aa53b..77e250c5de923 100644 --- a/app/code/Magento/Customer/view/frontend/templates/form/login.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/form/login.phtml @@ -42,3 +42,13 @@ </form> </div> </div> + +<script type="text/x-magento-init"> + { + ".field.email": { + "Magento_Customer/js/trim-username": { + "formSelector": "form.form-login" + } + } + } +</script> diff --git a/app/code/Magento/Customer/view/frontend/web/js/trim-username.js b/app/code/Magento/Customer/view/frontend/web/js/trim-username.js new file mode 100644 index 0000000000000..1b6aab6086853 --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/web/js/trim-username.js @@ -0,0 +1,65 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery' +], function ($) { + 'use strict'; + + $.widget('mage.trimUsername', { + options: { + cache: {}, + formSelector: 'form', + emailSelector: 'input[type="email"]' + }, + + /** + * Widget initialization + * @private + */ + _create: function () { + // We need to look outside the module for backward compatibility, since someone can already use the module. + // @todo Narrow this selector in 2.3 so it doesn't accidentally finds the email field from the + // newsletter email field or any other "email" field. + this.options.cache.email = $(this.options.formSelector).find(this.options.emailSelector); + this._bind(); + }, + + /** + * Event binding, will monitor change, keyup and paste events. + * @private + */ + _bind: function () { + if (this.options.cache.email.length) { + this._on(this.options.cache.email, { + 'change': this._trimUsername, + 'keyup': this._trimUsername, + 'paste': this._trimUsername + }); + } + }, + + /** + * Trim username + * @private + */ + _trimUsername: function () { + var username = this._getUsername().trim(); + + this.options.cache.email.val(username); + }, + + /** + * Get username value + * @returns {*} + * @private + */ + _getUsername: function () { + return this.options.cache.email.val(); + } + }); + + return $.mage.trimUsername; +}); From a8515408a1879dc2e1c0e39615f9a431746584e8 Mon Sep 17 00:00:00 2001 From: Chirag Matholiya <chirag@wagento.com> Date: Wed, 6 Jun 2018 16:38:12 +0530 Subject: [PATCH 052/133] Solve overlapping Issue on every Home page & category page of Hot Seller section. --- .../luma/Magento_Catalog/web/css/source/module/_listings.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less index 01b8c7be93aec..9337bb79e7ed1 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less @@ -443,7 +443,7 @@ .product-item { margin-left: calc(~'(100% - 4 * 24.439%) / 3'); - padding: 0; + padding: 5px; width: 24.439%; &:nth-child(4n + 1) { From f6a18e0e18fd3dfd2614a5a6ac366f1c7b5416f9 Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Wed, 6 Jun 2018 15:23:04 +0300 Subject: [PATCH 053/133] MAGETWO-91102: [2.3.0] Admin orders being sent to Signifyd for review when they shouldn't --- .../Magento/Signifyd/Block/Fingerprint.php | 4 +- app/code/Magento/Signifyd/Model/Config.php | 24 ++-- .../Model/SignifydGateway/ApiClient.php | 7 +- .../Client/HttpClientFactory.php | 22 +-- .../SignifydGateway/Client/RequestBuilder.php | 11 +- .../SignifydGateway/Client/RequestSender.php | 7 +- .../Debugger/DebuggerFactory.php | 7 +- .../Model/SignifydGateway/Gateway.php | 60 ++++++++- .../Magento/Signifyd/Observer/PlaceOrder.php | 9 +- .../Client/HttpClientFactoryTest.php | 5 +- .../Model/SignifydGateway/GatewayTest.php | 125 +++++++++++++++++- .../Test/Unit/Observer/PlaceOrderTest.php | 33 +++-- .../Signifyd/Observer/PlaceOrderTest.php | 41 ++++++ ..._with_customer_and_two_simple_products.php | 37 +++--- .../Signifyd/_files/website_configuration.php | 67 ++++++++++ .../_files/website_configuration_rollback.php | 44 ++++++ 16 files changed, 420 insertions(+), 83 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration.php create mode 100644 dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration_rollback.php diff --git a/app/code/Magento/Signifyd/Block/Fingerprint.php b/app/code/Magento/Signifyd/Block/Fingerprint.php index 7afa092b3d0da..db76fc6c94468 100644 --- a/app/code/Magento/Signifyd/Block/Fingerprint.php +++ b/app/code/Magento/Signifyd/Block/Fingerprint.php @@ -85,6 +85,8 @@ public function getSignifydOrderSessionId() */ public function isModuleActive() { - return $this->config->isActive(); + $storeId = $this->quoteSession->getQuote()->getStoreId(); + + return $this->config->isActive($storeId); } } diff --git a/app/code/Magento/Signifyd/Model/Config.php b/app/code/Magento/Signifyd/Model/Config.php index b68380ee15bf3..15d3608bd38c4 100644 --- a/app/code/Magento/Signifyd/Model/Config.php +++ b/app/code/Magento/Signifyd/Model/Config.php @@ -34,13 +34,15 @@ public function __construct(ScopeConfigInterface $scopeConfig) * If this config option set to false no Signifyd integration should be available * (only possibility to configure Signifyd setting in admin) * + * @param int|null $storeId * @return bool */ - public function isActive() + public function isActive($storeId = null): bool { $enabled = $this->scopeConfig->isSetFlag( 'fraud_protection/signifyd/active', - ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE, + $storeId ); return $enabled; } @@ -51,13 +53,15 @@ public function isActive() * @see https://www.signifyd.com/docs/api/#/introduction/authentication * @see https://app.signifyd.com/settings * + * @param int|null $storeId * @return string */ - public function getApiKey() + public function getApiKey($storeId = null): string { $apiKey = $this->scopeConfig->getValue( 'fraud_protection/signifyd/api_key', - ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE, + $storeId ); return $apiKey; } @@ -66,13 +70,15 @@ public function getApiKey() * Base URL to Signifyd REST API. * Usually equals to https://api.signifyd.com/v2 and should not be changed * + * @param int|null $storeId * @return string */ - public function getApiUrl() + public function getApiUrl($storeId = null): string { $apiUrl = $this->scopeConfig->getValue( 'fraud_protection/signifyd/api_url', - ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE, + $storeId ); return $apiUrl; } @@ -80,13 +86,15 @@ public function getApiUrl() /** * If is "true" extra information about interaction with Signifyd API are written to debug.log file * + * @param int|null $storeId * @return bool */ - public function isDebugModeEnabled() + public function isDebugModeEnabled($storeId = null): bool { $debugModeEnabled = $this->scopeConfig->isSetFlag( 'fraud_protection/signifyd/debug', - ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE, + $storeId ); return $debugModeEnabled; } diff --git a/app/code/Magento/Signifyd/Model/SignifydGateway/ApiClient.php b/app/code/Magento/Signifyd/Model/SignifydGateway/ApiClient.php index 0950ca1e22cfa..2d6d57a510ae3 100644 --- a/app/code/Magento/Signifyd/Model/SignifydGateway/ApiClient.php +++ b/app/code/Magento/Signifyd/Model/SignifydGateway/ApiClient.php @@ -36,12 +36,13 @@ public function __construct( * * @param string $url * @param string $method - * @param array $params + * @param array $params + * @param int|null $storeId * @return array */ - public function makeApiCall($url, $method, array $params = []) + public function makeApiCall($url, $method, array $params = [], $storeId = null): array { - $result = $this->requestBuilder->doRequest($url, $method, $params); + $result = $this->requestBuilder->doRequest($url, $method, $params, $storeId); return $result; } diff --git a/app/code/Magento/Signifyd/Model/SignifydGateway/Client/HttpClientFactory.php b/app/code/Magento/Signifyd/Model/SignifydGateway/Client/HttpClientFactory.php index 41006bd7d1e0e..2a9b933b98b5d 100644 --- a/app/code/Magento/Signifyd/Model/SignifydGateway/Client/HttpClientFactory.php +++ b/app/code/Magento/Signifyd/Model/SignifydGateway/Client/HttpClientFactory.php @@ -73,12 +73,13 @@ public function __construct( * @param string $url * @param string $method * @param array $params + * @param int|null $storeId * @return ZendClient */ - public function create($url, $method, array $params = []) + public function create($url, $method, array $params = [], $storeId = null): ZendClient { - $apiKey = $this->getApiKey(); - $apiUrl = $this->buildFullApiUrl($url); + $apiKey = $this->getApiKey($storeId); + $apiUrl = $this->buildFullApiUrl($url, $storeId); $client = $this->createNewClient(); $client->setHeaders( @@ -107,22 +108,24 @@ private function createNewClient() * Signifyd API key for merchant account. * * @see https://www.signifyd.com/docs/api/#/introduction/authentication + * @param int|null $storeId * @return string */ - private function getApiKey() + private function getApiKey($storeId): string { - return $this->config->getApiKey(); + return $this->config->getApiKey($storeId); } /** * Full URL for Singifyd API based on relative URL. * * @param string $url + * @param int|null $storeId * @return string */ - private function buildFullApiUrl($url) + private function buildFullApiUrl($url, $storeId): string { - $baseApiUrl = $this->getBaseApiUrl(); + $baseApiUrl = $this->getBaseApiUrl($storeId); $fullUrl = $baseApiUrl . self::$urlSeparator . ltrim($url, self::$urlSeparator); return $fullUrl; @@ -131,11 +134,12 @@ private function buildFullApiUrl($url) /** * Base Sigifyd API URL without trailing slash. * + * @param int|null $storeId * @return string */ - private function getBaseApiUrl() + private function getBaseApiUrl($storeId): string { - $baseApiUrl = $this->config->getApiUrl(); + $baseApiUrl = $this->config->getApiUrl($storeId); return rtrim($baseApiUrl, self::$urlSeparator); } diff --git a/app/code/Magento/Signifyd/Model/SignifydGateway/Client/RequestBuilder.php b/app/code/Magento/Signifyd/Model/SignifydGateway/Client/RequestBuilder.php index 2ab4395e1990d..ee079a74d345f 100644 --- a/app/code/Magento/Signifyd/Model/SignifydGateway/Client/RequestBuilder.php +++ b/app/code/Magento/Signifyd/Model/SignifydGateway/Client/RequestBuilder.php @@ -5,8 +5,6 @@ */ namespace Magento\Signifyd\Model\SignifydGateway\Client; -use Magento\Framework\HTTP\ZendClient; - /** * Class RequestBuilder * Creates HTTP client, sends request to Signifyd and handles response @@ -50,13 +48,14 @@ public function __construct( * * @param string $url * @param string $method - * @param array $params + * @param array $params + * @param int|null $storeId * @return array */ - public function doRequest($url, $method, array $params = []) + public function doRequest($url, $method, array $params = [], $storeId = null): array { - $client = $this->clientCreator->create($url, $method, $params); - $response = $this->requestSender->send($client); + $client = $this->clientCreator->create($url, $method, $params, $storeId); + $response = $this->requestSender->send($client, $storeId); $result = $this->responseHandler->handle($response); return $result; diff --git a/app/code/Magento/Signifyd/Model/SignifydGateway/Client/RequestSender.php b/app/code/Magento/Signifyd/Model/SignifydGateway/Client/RequestSender.php index 38128a799fd59..a63331e055c1c 100644 --- a/app/code/Magento/Signifyd/Model/SignifydGateway/Client/RequestSender.php +++ b/app/code/Magento/Signifyd/Model/SignifydGateway/Client/RequestSender.php @@ -39,15 +39,16 @@ public function __construct( * debug information is recorded to debug.log. * * @param ZendClient $client + * @param int|null $storeId * @return \Zend_Http_Response * @throws ApiCallException */ - public function send(ZendClient $client) + public function send(ZendClient $client, $storeId = null): \Zend_Http_Response { try { $response = $client->request(); - $this->debuggerFactory->create()->success( + $this->debuggerFactory->create($storeId)->success( $client->getUri(true), $client->getLastRequest(), $response->getStatus() . ' ' . $response->getMessage(), @@ -56,7 +57,7 @@ public function send(ZendClient $client) return $response; } catch (\Exception $e) { - $this->debuggerFactory->create()->failure( + $this->debuggerFactory->create($storeId)->failure( $client->getUri(true), $client->getLastRequest(), $e diff --git a/app/code/Magento/Signifyd/Model/SignifydGateway/Debugger/DebuggerFactory.php b/app/code/Magento/Signifyd/Model/SignifydGateway/Debugger/DebuggerFactory.php index 02031e6f5b9b5..edc0137a43615 100644 --- a/app/code/Magento/Signifyd/Model/SignifydGateway/Debugger/DebuggerFactory.php +++ b/app/code/Magento/Signifyd/Model/SignifydGateway/Debugger/DebuggerFactory.php @@ -30,7 +30,7 @@ class DebuggerFactory /** * DebuggerFactory constructor. * - * @param bjectManagerInterface $objectManager + * @param objectManagerInterface $objectManager * @param Config $config */ public function __construct( @@ -44,11 +44,12 @@ public function __construct( /** * Create debugger instance * + * @param int|null $storeId * @return DebuggerInterface */ - public function create() + public function create($storeId = null): DebuggerInterface { - if (!$this->config->isDebugModeEnabled()) { + if (!$this->config->isDebugModeEnabled($storeId)) { return $this->objectManager->get(BlackHole::class); } diff --git a/app/code/Magento/Signifyd/Model/SignifydGateway/Gateway.php b/app/code/Magento/Signifyd/Model/SignifydGateway/Gateway.php index ddcaa6cd696f2..9f7a053c58724 100644 --- a/app/code/Magento/Signifyd/Model/SignifydGateway/Gateway.php +++ b/app/code/Magento/Signifyd/Model/SignifydGateway/Gateway.php @@ -5,8 +5,9 @@ */ namespace Magento\Signifyd\Model\SignifydGateway; +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Signifyd\Api\CaseRepositoryInterface; use Magento\Signifyd\Model\SignifydGateway\Request\CreateCaseBuilderInterface; -use Magento\Signifyd\Model\SignifydGateway\ApiClient; /** * Signifyd Gateway. @@ -53,18 +54,34 @@ class Gateway */ private $apiClient; + /** + * @var OrderRepositoryInterface + */ + private $orderRepository; + + /** + * @var CaseRepositoryInterface + */ + private $caseRepository; + /** * Gateway constructor. * * @param CreateCaseBuilderInterface $createCaseBuilder * @param ApiClient $apiClient + * @param OrderRepositoryInterface $orderRepository + * @param CaseRepositoryInterface $caseRepository */ public function __construct( CreateCaseBuilderInterface $createCaseBuilder, - ApiClient $apiClient + ApiClient $apiClient, + OrderRepositoryInterface $orderRepository, + CaseRepositoryInterface $caseRepository ) { $this->createCaseBuilder = $createCaseBuilder; $this->apiClient = $apiClient; + $this->orderRepository = $orderRepository; + $this->caseRepository = $caseRepository; } /** @@ -78,11 +95,13 @@ public function __construct( public function createCase($orderId) { $caseParams = $this->createCaseBuilder->build($orderId); + $storeId = $this->getStoreIdFromOrder($orderId); $caseCreationResult = $this->apiClient->makeApiCall( '/cases', 'POST', - $caseParams + $caseParams, + $storeId ); if (!isset($caseCreationResult['investigationId'])) { @@ -102,12 +121,14 @@ public function createCase($orderId) */ public function submitCaseForGuarantee($signifydCaseId) { + $storeId = $this->getStoreIdFromCase($signifydCaseId); $guaranteeCreationResult = $this->apiClient->makeApiCall( '/guarantees', 'POST', [ 'caseId' => $signifydCaseId, - ] + ], + $storeId ); $disposition = $this->processDispositionResult($guaranteeCreationResult); @@ -124,12 +145,14 @@ public function submitCaseForGuarantee($signifydCaseId) */ public function cancelGuarantee($caseId) { + $storeId = $this->getStoreIdFromCase($caseId); $result = $this->apiClient->makeApiCall( '/cases/' . $caseId . '/guarantee', 'PUT', [ 'guaranteeDisposition' => self::GUARANTEE_CANCELED - ] + ], + $storeId ); $disposition = $this->processDispositionResult($result); @@ -172,4 +195,31 @@ private function processDispositionResult(array $result) return $disposition; } + + /** + * Returns store id by case. + * + * @param int $caseId + * @return int|null + */ + private function getStoreIdFromCase(int $caseId) + { + $case = $this->caseRepository->getByCaseId($caseId); + $orderId = $case->getOrderId(); + + return $this->getStoreIdFromOrder($orderId); + } + + /** + * Returns store id from order. + * + * @param int $orderId + * @return int|null + */ + private function getStoreIdFromOrder(int $orderId) + { + $order = $this->orderRepository->get($orderId); + + return $order->getStoreId(); + } } diff --git a/app/code/Magento/Signifyd/Observer/PlaceOrder.php b/app/code/Magento/Signifyd/Observer/PlaceOrder.php index 3798522dbe506..8415bc006b8aa 100644 --- a/app/code/Magento/Signifyd/Observer/PlaceOrder.php +++ b/app/code/Magento/Signifyd/Observer/PlaceOrder.php @@ -55,10 +55,6 @@ public function __construct( */ public function execute(Observer $observer) { - if (!$this->signifydIntegrationConfig->isActive()) { - return; - } - $orders = $this->extractOrders( $observer->getEvent() ); @@ -68,7 +64,10 @@ public function execute(Observer $observer) } foreach ($orders as $order) { - $this->createCaseForOrder($order); + $storeId = $order->getStoreId(); + if ($this->signifydIntegrationConfig->isActive($storeId)) { + $this->createCaseForOrder($order); + } } } diff --git a/app/code/Magento/Signifyd/Test/Unit/Model/SignifydGateway/Client/HttpClientFactoryTest.php b/app/code/Magento/Signifyd/Test/Unit/Model/SignifydGateway/Client/HttpClientFactoryTest.php index 776e8a75b9646..4aefd63355773 100644 --- a/app/code/Magento/Signifyd/Test/Unit/Model/SignifydGateway/Client/HttpClientFactoryTest.php +++ b/app/code/Magento/Signifyd/Test/Unit/Model/SignifydGateway/Client/HttpClientFactoryTest.php @@ -101,14 +101,17 @@ public function testCreateHttpClient() public function testCreateWithParams() { $param = ['id' => 1]; + $storeId = 1; $json = '{"id":1}'; $this->config->expects($this->once()) ->method('getApiKey') + ->with($storeId) ->willReturn('testKey'); $this->config->expects($this->once()) ->method('getApiUrl') + ->with($storeId) ->willReturn(self::$dummy); $this->dataEncoder->expects($this->once()) @@ -121,7 +124,7 @@ public function testCreateWithParams() ->with($this->equalTo($json), 'application/json') ->willReturnSelf(); - $client = $this->httpClient->create('url', 'method', $param); + $client = $this->httpClient->create('url', 'method', $param, $storeId); $this->assertInstanceOf(ZendClient::class, $client); } diff --git a/app/code/Magento/Signifyd/Test/Unit/Model/SignifydGateway/GatewayTest.php b/app/code/Magento/Signifyd/Test/Unit/Model/SignifydGateway/GatewayTest.php index c34e64f469f77..2a05189e0e393 100644 --- a/app/code/Magento/Signifyd/Test/Unit/Model/SignifydGateway/GatewayTest.php +++ b/app/code/Magento/Signifyd/Test/Unit/Model/SignifydGateway/GatewayTest.php @@ -5,7 +5,10 @@ */ namespace Magento\Signifyd\Test\Unit\Model\SignifydGateway; -use \PHPUnit\Framework\TestCase as TestCase; +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Signifyd\Api\CaseRepositoryInterface; +use Magento\Signifyd\Api\Data\CaseInterface; use PHPUnit_Framework_MockObject_MockObject as MockObject; use Magento\Signifyd\Model\SignifydGateway\Gateway; use Magento\Signifyd\Model\SignifydGateway\GatewayException; @@ -30,6 +33,16 @@ class GatewayTest extends \PHPUnit\Framework\TestCase */ private $gateway; + /** + * @var OrderRepositoryInterface|MockObject + */ + private $orderRepository; + + /** + * @var CaseRepositoryInterface|MockObject + */ + private $caseRepository; + public function setUp() { $this->createCaseBuilder = $this->getMockBuilder(CreateCaseBuilderInterface::class) @@ -39,16 +52,27 @@ public function setUp() ->disableOriginalConstructor() ->getMock(); + $this->orderRepository = $this->getMockBuilder(OrderRepositoryInterface::class) + ->getMockForAbstractClass(); + + $this->caseRepository= $this->getMockBuilder(CaseRepositoryInterface::class) + ->getMockForAbstractClass(); + $this->gateway = new Gateway( $this->createCaseBuilder, - $this->apiClient + $this->apiClient, + $this->orderRepository, + $this->caseRepository ); } public function testCreateCaseForSpecifiedOrder() { $dummyOrderId = 1; + $dummyStoreId = 2; $dummySignifydInvestigationId = 42; + + $this->withOrderEntity($dummyOrderId, $dummyStoreId); $this->apiClient ->method('makeApiCall') ->willReturn([ @@ -68,7 +92,10 @@ public function testCreateCaseForSpecifiedOrder() public function testCreateCaseCallsValidApiMethod() { $dummyOrderId = 1; + $dummyStoreId = 2; $dummySignifydInvestigationId = 42; + + $this->withOrderEntity($dummyOrderId, $dummyStoreId); $this->createCaseBuilder ->method('build') ->willReturn([]); @@ -79,7 +106,8 @@ public function testCreateCaseCallsValidApiMethod() ->with( $this->equalTo('/cases'), $this->equalTo('POST'), - $this->isType('array') + $this->isType('array'), + $this->equalTo($dummyStoreId) ) ->willReturn([ 'investigationId' => $dummySignifydInvestigationId @@ -92,7 +120,10 @@ public function testCreateCaseCallsValidApiMethod() public function testCreateCaseNormalFlow() { $dummyOrderId = 1; + $dummyStoreId = 2; $dummySignifydInvestigationId = 42; + + $this->withOrderEntity($dummyOrderId, $dummyStoreId); $this->createCaseBuilder ->method('build') ->willReturn([]); @@ -113,7 +144,10 @@ public function testCreateCaseNormalFlow() public function testCreateCaseWithFailedApiCall() { $dummyOrderId = 1; + $dummyStoreId = 2; $apiCallFailureMessage = 'Api call failed'; + + $this->withOrderEntity($dummyOrderId, $dummyStoreId); $this->createCaseBuilder ->method('build') ->willReturn([]); @@ -129,6 +163,9 @@ public function testCreateCaseWithFailedApiCall() public function testCreateCaseWithMissedResponseRequiredData() { $dummyOrderId = 1; + $dummyStoreId = 2; + + $this->withOrderEntity($dummyOrderId, $dummyStoreId); $this->createCaseBuilder ->method('build') ->willReturn([]); @@ -145,7 +182,10 @@ public function testCreateCaseWithMissedResponseRequiredData() public function testCreateCaseWithAdditionalResponseData() { $dummyOrderId = 1; + $dummyStoreId = 2; $dummySignifydInvestigationId = 42; + + $this->withOrderEntity($dummyOrderId, $dummyStoreId); $this->createCaseBuilder ->method('build') ->willReturn([]); @@ -167,8 +207,10 @@ public function testCreateCaseWithAdditionalResponseData() public function testSubmitCaseForGuaranteeCallsValidApiMethod() { $dummySygnifydCaseId = 42; + $dummyStoreId = 1; $dummyDisposition = 'APPROVED'; + $this->withCaseEntity($dummySygnifydCaseId, $dummyStoreId); $this->apiClient ->expects($this->atLeastOnce()) ->method('makeApiCall') @@ -177,7 +219,8 @@ public function testSubmitCaseForGuaranteeCallsValidApiMethod() $this->equalTo('POST'), $this->equalTo([ 'caseId' => $dummySygnifydCaseId - ]) + ]), + $this->equalTo($dummyStoreId) )->willReturn([ 'disposition' => $dummyDisposition ]); @@ -189,8 +232,10 @@ public function testSubmitCaseForGuaranteeCallsValidApiMethod() public function testSubmitCaseForGuaranteeWithFailedApiCall() { $dummySygnifydCaseId = 42; + $dummyStoreId = 1; $apiCallFailureMessage = 'Api call failed'; + $this->withCaseEntity($dummySygnifydCaseId, $dummyStoreId); $this->apiClient ->method('makeApiCall') ->willThrowException(new ApiCallException($apiCallFailureMessage)); @@ -204,10 +249,12 @@ public function testSubmitCaseForGuaranteeWithFailedApiCall() public function testSubmitCaseForGuaranteeReturnsDisposition() { $dummySygnifydCaseId = 42; + $dummyStoreId = 1; $dummyDisposition = 'APPROVED'; $dummyGuaranteeId = 123; $dummyRereviewCount = 0; + $this->withCaseEntity($dummySygnifydCaseId, $dummyStoreId); $this->apiClient ->method('makeApiCall') ->willReturn([ @@ -227,9 +274,11 @@ public function testSubmitCaseForGuaranteeReturnsDisposition() public function testSubmitCaseForGuaranteeWithMissedDisposition() { $dummySygnifydCaseId = 42; + $dummyStoreId = 1; $dummyGuaranteeId = 123; $dummyRereviewCount = 0; + $this->withCaseEntity($dummySygnifydCaseId, $dummyStoreId); $this->apiClient ->method('makeApiCall') ->willReturn([ @@ -244,8 +293,10 @@ public function testSubmitCaseForGuaranteeWithMissedDisposition() public function testSubmitCaseForGuaranteeWithUnexpectedDisposition() { $dummySygnifydCaseId = 42; + $dummyStoreId = 1; $dummyUnexpectedDisposition = 'UNEXPECTED'; + $this->withCaseEntity($dummySygnifydCaseId, $dummyStoreId); $this->apiClient ->method('makeApiCall') ->willReturn([ @@ -263,7 +314,9 @@ public function testSubmitCaseForGuaranteeWithUnexpectedDisposition() public function testSubmitCaseForGuaranteeWithExpectedDisposition($dummyExpectedDisposition) { $dummySygnifydCaseId = 42; + $dummyStoreId = 1; + $this->withCaseEntity($dummySygnifydCaseId, $dummyStoreId); $this->apiClient ->method('makeApiCall') ->willReturn([ @@ -290,11 +343,20 @@ public function testSubmitCaseForGuaranteeWithExpectedDisposition($dummyExpected public function testCancelGuarantee() { $caseId = 123; + $dummyStoreId = 1; + $this->withCaseEntity($caseId, $dummyStoreId); $this->apiClient->expects(self::once()) ->method('makeApiCall') - ->with('/cases/' . $caseId . '/guarantee', 'PUT', ['guaranteeDisposition' => Gateway::GUARANTEE_CANCELED]) - ->willReturn(['disposition' => Gateway::GUARANTEE_CANCELED]); + ->with( + '/cases/' . $caseId . '/guarantee', + 'PUT', + ['guaranteeDisposition' => Gateway::GUARANTEE_CANCELED], + $dummyStoreId + ) + ->willReturn( + ['disposition' => Gateway::GUARANTEE_CANCELED] + ); $result = $this->gateway->cancelGuarantee($caseId); self::assertEquals(Gateway::GUARANTEE_CANCELED, $result); @@ -310,10 +372,17 @@ public function testCancelGuarantee() public function testCancelGuaranteeWithUnexpectedDisposition() { $caseId = 123; + $dummyStoreId = 1; + $this->withCaseEntity($caseId, $dummyStoreId); $this->apiClient->expects(self::once()) ->method('makeApiCall') - ->with('/cases/' . $caseId . '/guarantee', 'PUT', ['guaranteeDisposition' => Gateway::GUARANTEE_CANCELED]) + ->with( + '/cases/' . $caseId . '/guarantee', + 'PUT', + ['guaranteeDisposition' => Gateway::GUARANTEE_CANCELED], + $dummyStoreId + ) ->willReturn(['disposition' => Gateway::GUARANTEE_DECLINED]); $result = $this->gateway->cancelGuarantee($caseId); @@ -331,4 +400,46 @@ public function supportedGuaranteeDispositionsProvider() 'UNREQUESTED' => ['UNREQUESTED'], ]; } + + /** + * Specifies order entity mock execution. + * + * @param int $orderId + * @param int $storeId + * @return void + */ + private function withOrderEntity(int $orderId, int $storeId): void + { + $orderEntity = $this->getMockBuilder(OrderInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $orderEntity->method('getStoreId') + ->willReturn($storeId); + $this->orderRepository->method('get') + ->with($orderId) + ->willReturn($orderEntity); + } + + /** + * Specifies case entity mock execution. + * + * @param int $caseId + * @param int $storeId + * @return void + */ + private function withCaseEntity(int $caseId, int $storeId): void + { + $orderId = 1; + + $caseEntity = $this->getMockBuilder(CaseInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $caseEntity->method('getOrderId') + ->willReturn($orderId); + $this->caseRepository->method('getByCaseId') + ->with($caseId) + ->willReturn($caseEntity); + + $this->withOrderEntity($orderId, $storeId); + } } diff --git a/app/code/Magento/Signifyd/Test/Unit/Observer/PlaceOrderTest.php b/app/code/Magento/Signifyd/Test/Unit/Observer/PlaceOrderTest.php index e2870953ec280..4e7edddf7b948 100644 --- a/app/code/Magento/Signifyd/Test/Unit/Observer/PlaceOrderTest.php +++ b/app/code/Magento/Signifyd/Test/Unit/Observer/PlaceOrderTest.php @@ -97,7 +97,10 @@ protected function setUp() */ public function testExecuteWithDisabledModule() { - $this->withActiveSignifydIntegration(false); + $orderId = 1; + $storeId = 2; + $this->withActiveSignifydIntegration(false, $storeId); + $this->withOrderEntity($orderId, $storeId); $this->creationService->expects(self::never()) ->method('createForOrder'); @@ -113,7 +116,7 @@ public function testExecuteWithDisabledModule() public function testExecuteWithoutOrder() { $this->withActiveSignifydIntegration(true); - $this->withOrderEntity(null); + $this->withOrderEntity(null, null); $this->creationService->expects(self::never()) ->method('createForOrder'); @@ -129,8 +132,9 @@ public function testExecuteWithoutOrder() public function testExecuteWithOfflinePayment() { $orderId = 1; - $this->withActiveSignifydIntegration(true); - $this->withOrderEntity($orderId); + $storeId = 2; + $this->withActiveSignifydIntegration(true, $storeId); + $this->withOrderEntity($orderId, $storeId); $this->withAvailablePaymentMethod(false); $this->creationService->expects(self::never()) @@ -147,10 +151,11 @@ public function testExecuteWithOfflinePayment() public function testExecuteWithFailedCaseCreation() { $orderId = 1; + $storeId = 2; $exceptionMessage = __('Case with the same order id already exists.'); - $this->withActiveSignifydIntegration(true); - $this->withOrderEntity($orderId); + $this->withActiveSignifydIntegration(true, $storeId); + $this->withOrderEntity($orderId, $storeId); $this->withAvailablePaymentMethod(true); $this->creationService->method('createForOrder') @@ -172,9 +177,10 @@ public function testExecuteWithFailedCaseCreation() public function testExecute() { $orderId = 1; + $storeId = 2; - $this->withActiveSignifydIntegration(true); - $this->withOrderEntity($orderId); + $this->withActiveSignifydIntegration(true, $storeId); + $this->withOrderEntity($orderId, $storeId); $this->withAvailablePaymentMethod(true); $this->creationService @@ -190,10 +196,11 @@ public function testExecute() /** * Specifies order entity mock execution. * - * @param int $orderId + * @param int|null $orderId + * @param int|null $storeId * @return void */ - private function withOrderEntity($orderId) + private function withOrderEntity($orderId, $storeId): void { $this->orderEntity = $this->getMockBuilder(OrderInterface::class) ->disableOriginalConstructor() @@ -201,6 +208,8 @@ private function withOrderEntity($orderId) $this->orderEntity->method('getEntityId') ->willReturn($orderId); + $this->orderEntity->method('getStoreId') + ->willReturn($storeId); $this->observer->method('getEvent') ->willReturn($this->event); @@ -214,11 +223,13 @@ private function withOrderEntity($orderId) * Specifies config mock execution. * * @param bool $isActive + * @param int|null $storeId * @return void */ - private function withActiveSignifydIntegration($isActive) + private function withActiveSignifydIntegration(bool $isActive, $storeId = null): void { $this->config->method('isActive') + ->with($storeId) ->willReturn($isActive); } diff --git a/dev/tests/integration/testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php b/dev/tests/integration/testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php index d4204314453e5..b712e20f1f56c 100644 --- a/dev/tests/integration/testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php +++ b/dev/tests/integration/testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php @@ -12,6 +12,8 @@ use Magento\Sales\Api\Data\OrderInterface; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Signifyd\Api\CaseCreationServiceInterface; +use Magento\Store\Api\StoreRepositoryInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\MockObject_MockObject as MockObject; use Psr\Log\LoggerInterface; @@ -102,6 +104,45 @@ public function testExecute() ->method('createForOrder') ->with(self::equalTo($order->getEntityId())); + $event = $this->objectManager->create( + Event::class, + [ + 'data' => ['order' => $order], + ] + ); + + /** @var Observer $observer */ + $observer = $this->objectManager->get(Observer::class); + $observer->setEvent($event); + + $this->placeOrder->execute($observer); + } + + /** + * Signifyd is enabled for default store. + * Checks a test case when order placed with website where signifyd is disabled. + * + * @return void + * @covers \Magento\Signifyd\Observer\PlaceOrder::execute + * @magentoDataFixture Magento/Signifyd/_files/order_with_customer_and_two_simple_products.php + * @magentoDataFixture Magento/Signifyd/_files/website_configuration.php + */ + public function testExecuteWithWebsiteConfiguration(): void + { + /** @var StoreRepositoryInterface $storeRepository */ + $storeRepository = $this->objectManager->get(StoreRepositoryInterface::class); + $store = $storeRepository->get('test_second_store'); + + /** @var StoreManagerInterface $storeManager */ + $storeManager = $this->objectManager->get(StoreManagerInterface::class); + $storeManager->setCurrentStore($store->getId()); + + $order = $this->getOrder('100000001'); + $order->setStoreId($store->getId()); + + $this->creationService->expects(self::never()) + ->method('createForOrder'); + $event = $this->objectManager->create( Event::class, [ diff --git a/dev/tests/integration/testsuite/Magento/Signifyd/_files/order_with_customer_and_two_simple_products.php b/dev/tests/integration/testsuite/Magento/Signifyd/_files/order_with_customer_and_two_simple_products.php index 8991825c9381e..49a0a2d33e236 100644 --- a/dev/tests/integration/testsuite/Magento/Signifyd/_files/order_with_customer_and_two_simple_products.php +++ b/dev/tests/integration/testsuite/Magento/Signifyd/_files/order_with_customer_and_two_simple_products.php @@ -10,7 +10,7 @@ use Magento\Sales\Api\OrderRepositoryInterface; use Magento\TestFramework\Helper\Bootstrap; -require __DIR__ . '/../../../Magento/Catalog/_files/multiple_products.php'; +require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; require __DIR__ . '/store.php'; @@ -36,33 +36,28 @@ ->setCcExpMonth('01') ->setCcExpYear('21'); -/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */ -$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); - -$product1 = $productRepository->get('simple1'); /** @var Item $orderItem */ $orderItem1 = $objectManager->create(Item::class); -$orderItem1->setProductId($product1->getId()) - ->setSku($product1->getSku()) - ->setName($product1->getName()) +$orderItem1->setProductId($product->getId()) + ->setSku($product->getSku()) + ->setName($product->getName()) ->setQtyOrdered(1) - ->setBasePrice($product1->getPrice()) - ->setPrice($product1->getPrice()) - ->setRowTotal($product1->getPrice()) - ->setProductType($product1->getTypeId()); + ->setBasePrice($product->getPrice()) + ->setPrice($product->getPrice()) + ->setRowTotal($product->getPrice()) + ->setProductType($product->getTypeId()); -$product2 = $productRepository->get('simple2'); /** @var Item $orderItem */ $orderItem2 = $objectManager->create(Item::class); -$orderItem2->setProductId($product2->getId()) - ->setSku($product2->getSku()) - ->setName($product2->getName()) - ->setPrice($product2->getPrice()) +$orderItem2->setProductId($product->getId()) + ->setSku('simple2') + ->setName('Simple product') + ->setPrice(100) ->setQtyOrdered(2) - ->setBasePrice($product2->getPrice()) - ->setPrice($product2->getPrice()) - ->setRowTotal($product2->getPrice()) - ->setProductType($product2->getTypeId()); + ->setBasePrice($product->getPrice()) + ->setPrice($product->getPrice()) + ->setRowTotal($product->getPrice()) + ->setProductType($product->getTypeId()); $orderAmount = 100; $customerEmail = $billingAddress->getEmail(); diff --git a/dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration.php b/dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration.php new file mode 100644 index 0000000000000..e53b0431503e7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Config\Model\Config; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ResourceModel\Store as StoreResourceModel; +use Magento\Store\Model\ResourceModel\Website as WebsiteResourceModel; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Model\Website; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); + +/** @var $website Website */ +$website = $objectManager->create(Website::class); +$website->setData(['code' => 'test_website', 'name' => 'Test Website', 'default_group_id' => '1', 'is_default' => '0']); +$websiteResourceModel = $objectManager->create(WebsiteResourceModel::class); +$websiteResourceModel->save($website); + +$websiteId = $website->getId(); +$store = $objectManager->create(Store::class); +$groupId = Bootstrap::getObjectManager()->get(StoreManagerInterface::class) + ->getWebsite() + ->getDefaultGroupId(); +$store->setCode('test_second_store') + ->setWebsiteId($websiteId) + ->setGroupId($groupId) + ->setName('Test Second Store') + ->setSortOrder(10) + ->setIsActive(1); +$storeResourceModel = $objectManager->create(StoreResourceModel::class); +$storeResourceModel->save($store); + +/* Refresh stores memory cache */ +$objectManager->get(StoreManagerInterface::class)->reinitStores(); + +$processConfigData = function (Config $config, array $data) { + foreach ($data as $key => $value) { + $config->setDataByPath($key, $value); + $config->save(); + } +}; + +// save signifyd configuration for the default scope +$configData = [ + 'fraud_protection/signifyd/active' => '1', +]; +/** @var Config $defConfig */ +$defConfig = $objectManager->create(Config::class); +$defConfig->setScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT); +$processConfigData($defConfig, $configData); + +// save signifyd website config data +$websiteConfigData = [ + 'fraud_protection/signifyd/active' => '0', +]; +/** @var Config $websiteConfig */ +$websiteConfig = $objectManager->create(Config::class); +$websiteConfig->setScope(ScopeInterface::SCOPE_WEBSITES); +$websiteConfig->setWebsite($websiteId); +$processConfigData($websiteConfig, $websiteConfigData); diff --git a/dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration_rollback.php b/dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration_rollback.php new file mode 100644 index 0000000000000..9b731813fea3b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration_rollback.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\Config\Storage\WriterInterface; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\Website; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); + +$deleteConfigData = function (WriterInterface $writer, $scope, $scopeId) { + $configData = [ + 'fraud_protection/signifyd/active', + ]; + foreach ($configData as $path) { + $writer->delete($path, $scope, $scopeId); + } +}; + +/** @var WriterInterface $configWriter */ +$configWriter = $objectManager->get(WriterInterface::class); +$deleteConfigData($configWriter, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null); + +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$website = $websiteRepository->get('test_website'); +$deleteConfigData($configWriter, ScopeInterface::SCOPE_WEBSITES, $website->getId()); + +$website = $objectManager->create(Website::class); +/** @var $website Website */ +if ($website->load('test_website', 'code')->getId()) { + $website->delete(); +} +$store = $objectManager->create(Store::class); +if ($store->load('test_second_store', 'code')->getId()) { + $store->delete(); +} From 1ccc299d1e1b0e0b2a3a5dcf53b9fe4db54dd718 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Wed, 6 Jun 2018 15:25:57 +0300 Subject: [PATCH 054/133] MAGETWO-92130: An error happens when you have a new Critical Admin Notification and Release Notification window is opened --- .../Magento/Ui/view/base/web/js/modal/modal.js | 16 ++++++++++++---- .../Test/Page/Adminhtml/CatalogRuleNew.xml | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/modal/modal.js b/app/code/Magento/Ui/view/base/web/js/modal/modal.js index af2b31f7eab43..6c9b4b89bec7a 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/modal.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/modal.js @@ -336,11 +336,12 @@ define([ * Set z-index and margin for modal and overlay. */ _setActive: function () { - var zIndex = this.modal.zIndex(); + var zIndex = this.modal.zIndex(), + baseIndex = zIndex + this._getVisibleCount(); + this.overlay.zIndex(++baseIndex); this.prevOverlayIndex = this.overlay.zIndex(); - this.modal.zIndex(zIndex + this._getVisibleCount()); - this.overlay.zIndex(zIndex + (this._getVisibleCount() - 1)); + this.modal.zIndex(this.overlay.zIndex() + 1); if (this._getVisibleSlideCount()) { this.modal.css('marginLeft', this.options.modalLeftMargin * this._getVisibleSlideCount()); @@ -354,7 +355,14 @@ define([ this.modal.removeAttr('style'); if (this.overlay) { - this.overlay.zIndex(this.prevOverlayIndex); + // In cases when one modal is closed but there is another modal open (e.g. admin notifications) + // to avoid collisions between overlay and modal zIndexes + // overlay zIndex is set to be less than modal one + if (this._getVisibleCount() === 1) { + this.overlay.zIndex(this.prevOverlayIndex - 1); + } else { + this.overlay.zIndex(this.prevOverlayIndex); + } } }, diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleNew.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleNew.xml index 1823dd1e1bbe2..ba4ff8d42d951 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleNew.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleNew.xml @@ -9,6 +9,6 @@ <page name="CatalogRuleNew" area="Adminhtml" mca="catalog_rule/promo_catalog/new" module="Magento_CatalogRule"> <block name="formPageActions" class="Magento\CatalogRule\Test\Block\Adminhtml\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="editForm" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\PromoForm" locator="[id='page:main-container']" strategy="css selector"/> - <block name="modalBlock" class="Magento\Ui\Test\Block\Adminhtml\Modal" locator="._show[data-role=modal][style='z-index: 900;']" strategy="css selector"/> + <block name="modalBlock" class="Magento\Ui\Test\Block\Adminhtml\Modal" locator="._show[data-role=modal][style='z-index: 902;']" strategy="css selector"/> </page> </config> From 400960ca432e34222f715a8357c34dbff45f880a Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Wed, 6 Jun 2018 15:45:41 +0300 Subject: [PATCH 055/133] MAGETWO-91102: [2.3.0] Admin orders being sent to Signifyd for review when they shouldn't --- .../testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php b/dev/tests/integration/testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php index b712e20f1f56c..e547187be5ed7 100644 --- a/dev/tests/integration/testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php +++ b/dev/tests/integration/testsuite/Magento/Signifyd/Observer/PlaceOrderTest.php @@ -18,6 +18,11 @@ use PHPUnit\Framework\MockObject_MockObject as MockObject; use Psr\Log\LoggerInterface; +/** + * Test for Magento\Signifyd\Observer\PlaceOrderTest class. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class PlaceOrderTest extends \PHPUnit\Framework\TestCase { /** @@ -146,7 +151,7 @@ public function testExecuteWithWebsiteConfiguration(): void $event = $this->objectManager->create( Event::class, [ - 'data' => ['order' => $order] + 'data' => ['order' => $order], ] ); From 25bc40e8f19a6ff717a5ed58956d4d4b39855e43 Mon Sep 17 00:00:00 2001 From: DianaRusin <rusind95@gmail.com> Date: Wed, 6 Jun 2018 17:43:59 +0300 Subject: [PATCH 056/133] MAGETWO-65458: Cart Rules are not excluding Bundle Products --- app/code/Magento/Bundle/composer.json | 3 +- app/code/Magento/Bundle/etc/di.xml | 7 ++ .../Model/Quote/ChildrenValidationLocator.php | 53 +++++++++++++ .../Magento/SalesRule/Model/RulesApplier.php | 22 +++++- .../Test/Unit/Model/RulesApplierTest.php | 20 ++++- .../_files/quote_with_bundle_and_options.php | 54 +++++++++++++ ...quote_with_bundle_and_options_rollback.php | 28 +++++++ .../Model/Rule/Condition/ProductTest.php | 22 ++++++ .../SalesRule/_files/rules_sku_exclude.php | 79 +++++++++++++++++++ .../_files/rules_sku_exclude_rollback.php | 29 +++++++ 10 files changed, 313 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/SalesRule/Model/Quote/ChildrenValidationLocator.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/quote_with_bundle_and_options.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/quote_with_bundle_and_options_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude.php create mode 100644 dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude_rollback.php diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index aa2b9e12f7701..60b988372a316 100644 --- a/app/code/Magento/Bundle/composer.json +++ b/app/code/Magento/Bundle/composer.json @@ -25,7 +25,8 @@ }, "suggest": { "magento/module-webapi": "*", - "magento/module-bundle-sample-data": "*" + "magento/module-bundle-sample-data": "*", + "magento/module-sales-rule": "101.0.*" }, "type": "magento2-module", "license": [ diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml index b7fba3937ded4..733b089dccd4b 100644 --- a/app/code/Magento/Bundle/etc/di.xml +++ b/app/code/Magento/Bundle/etc/di.xml @@ -207,4 +207,11 @@ </argument> </arguments> </type> + <type name="Magento\SalesRule\Model\Quote\ChildrenValidationLocator"> + <arguments> + <argument name="productTypeChildrenValidationMap" xsi:type="array"> + <item name="bundle" xsi:type="boolean">false</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/SalesRule/Model/Quote/ChildrenValidationLocator.php b/app/code/Magento/SalesRule/Model/Quote/ChildrenValidationLocator.php new file mode 100644 index 0000000000000..af1f61c187129 --- /dev/null +++ b/app/code/Magento/SalesRule/Model/Quote/ChildrenValidationLocator.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\SalesRule\Model\Quote; + +use Magento\Quote\Model\Quote\Item\AbstractItem as QuoteItem; + +/** + * Used to determine necessity to validate rule on item's children that may depends on product type. + */ +class ChildrenValidationLocator +{ + /** + * @var array + */ + private $productTypeChildrenValidationMap; + + /** + * @param array $productTypeChildrenValidationMap + * <pre> + * [ + * 'ProductType1' => true, + * 'ProductType2' => false + * ] + * </pre> + */ + public function __construct( + array $productTypeChildrenValidationMap = [] + ) { + $this->productTypeChildrenValidationMap = $productTypeChildrenValidationMap; + } + + /** + * Checks necessity to validate rule on item's children. + * + * @param QuoteItem $item + * @return bool + */ + public function isChildrenValidationRequired(QuoteItem $item): bool + { + $type = $item->getProduct()->getTypeId(); + if (isset($this->productTypeChildrenValidationMap[$type])) { + return (bool)$this->productTypeChildrenValidationMap[$type]; + } + + return true; + } +} diff --git a/app/code/Magento/SalesRule/Model/RulesApplier.php b/app/code/Magento/SalesRule/Model/RulesApplier.php index 06a4e252bf60e..69467ca7cd0ea 100644 --- a/app/code/Magento/SalesRule/Model/RulesApplier.php +++ b/app/code/Magento/SalesRule/Model/RulesApplier.php @@ -6,6 +6,9 @@ namespace Magento\SalesRule\Model; use Magento\Quote\Model\Quote\Address; +use Magento\SalesRule\Model\Quote\ChildrenValidationLocator; +use Magento\Framework\App\ObjectManager; +use Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory; /** * Class RulesApplier @@ -25,19 +28,33 @@ class RulesApplier */ protected $validatorUtility; + /** + * @var ChildrenValidationLocator + */ + private $childrenValidationLocator; + + /** + * @var CalculatorFactory + */ + private $calculatorFactory; + /** * @param \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\SalesRule\Model\Utility $utility + * @param ChildrenValidationLocator $childrenValidationLocator */ public function __construct( \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory, \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\SalesRule\Model\Utility $utility + \Magento\SalesRule\Model\Utility $utility, + ChildrenValidationLocator $childrenValidationLocator = null ) { $this->calculatorFactory = $calculatorFactory; $this->validatorUtility = $utility; $this->_eventManager = $eventManager; + $this->childrenValidationLocator = $childrenValidationLocator + ?: ObjectManager::getInstance()->get(ChildrenValidationLocator::class); } /** @@ -61,6 +78,9 @@ public function applyRules($item, $rules, $skipValidation, $couponCode) } if (!$skipValidation && !$rule->getActions()->validate($item)) { + if (!$this->childrenValidationLocator->isChildrenValidationRequired($item)) { + continue; + } $childItems = $item->getChildren(); $isContinue = true; if (!empty($childItems)) { diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/RulesApplierTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/RulesApplierTest.php index 814048c2ac1d0..37c839d413d4b 100644 --- a/app/code/Magento/SalesRule/Test/Unit/Model/RulesApplierTest.php +++ b/app/code/Magento/SalesRule/Test/Unit/Model/RulesApplierTest.php @@ -6,6 +6,9 @@ namespace Magento\SalesRule\Test\Unit\Model; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class RulesApplierTest extends \PHPUnit\Framework\TestCase { /** @@ -28,6 +31,11 @@ class RulesApplierTest extends \PHPUnit\Framework\TestCase */ protected $validatorUtility; + /** + * @var \Magento\SalesRule\Model\Quote\ChildrenValidationLocator|\PHPUnit_Framework_MockObject_MockObject + */ + protected $childrenValidationLocator; + protected function setUp() { $this->calculatorFactory = $this->createMock( @@ -38,11 +46,15 @@ protected function setUp() \Magento\SalesRule\Model\Utility::class, ['canProcessRule', 'minFix', 'deltaRoundingFix', 'getItemQty'] ); - + $this->childrenValidationLocator = $this->createPartialMock( + \Magento\SalesRule\Model\Quote\ChildrenValidationLocator::class, + ['isChildrenValidationRequired'] + ); $this->rulesApplier = new \Magento\SalesRule\Model\RulesApplier( $this->calculatorFactory, $this->eventManager, - $this->validatorUtility + $this->validatorUtility, + $this->childrenValidationLocator ); } @@ -84,6 +96,10 @@ public function testApplyRulesWhenRuleWithStopRulesProcessingIsUsed($isChildren, $item->setDiscountCalculationPrice($positivePrice); $item->setData('calculation_price', $positivePrice); + $this->childrenValidationLocator->expects($this->any()) + ->method('isChildrenValidationRequired') + ->willReturn(true); + $this->validatorUtility->expects($this->atLeastOnce()) ->method('canProcessRule') ->will($this->returnValue(true)); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/quote_with_bundle_and_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/quote_with_bundle_and_options.php new file mode 100644 index 0000000000000..03949115ea62c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/quote_with_bundle_and_options.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +use Magento\TestFramework\Helper\Bootstrap; + +require __DIR__ . 'product_with_multiple_options.php'; + +$objectManager = Bootstrap::getObjectManager(); + +/** @var $product \Magento\Catalog\Model\Product */ +$product = $objectManager->create(\Magento\Catalog\Model\Product::class); +$product->load(3); + +/** @var $typeInstance \Magento\Bundle\Model\Product\Type */ +$typeInstance = $product->getTypeInstance(); +$typeInstance->setStoreFilter($product->getStoreId(), $product); +$optionCollection = $typeInstance->getOptionsCollection($product); + +$bundleOptions = []; +$bundleOptionsQty = []; +foreach ($optionCollection as $option) { + /** @var $option \Magento\Bundle\Model\Option */ + $selectionsCollection = $typeInstance->getSelectionsCollection([$option->getId()], $product); + if ($option->isMultiSelection()) { + $bundleOptions[$option->getId()] = array_column($selectionsCollection->toArray(), 'selection_id'); + } else { + $bundleOptions[$option->getId()] = $selectionsCollection->getFirstItem()->getSelectionId(); + } + $bundleOptionsQty[$option->getId()] = 1; +} + +$requestInfo = new \Magento\Framework\DataObject( + [ + 'product' => $product->getId(), + 'bundle_option' => $bundleOptions, + 'bundle_option_qty' => $bundleOptionsQty, + 'qty' => 1, + ] +); + +/** @var $cart \Magento\Checkout\Model\Cart */ +$cart = Bootstrap::getObjectManager()->create(\Magento\Checkout\Model\Cart::class); +$cart->addProduct($product, $requestInfo); +$cart->getQuote()->setReservedOrderId('test_cart_with_bundle_and_options'); +$cart->save(); + +/** @var $objectManager \Magento\TestFramework\ObjectManager */ +$objectManager = Bootstrap::getObjectManager(); +$objectManager->removeSharedInstance(\Magento\Checkout\Model\Session::class); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/quote_with_bundle_and_options_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/quote_with_bundle_and_options_rollback.php new file mode 100644 index 0000000000000..d32d6fab33319 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/quote_with_bundle_and_options_rollback.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +/** @var \Magento\Framework\Registry $registry */ +$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var $objectManager \Magento\TestFramework\ObjectManager */ +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$quote = $objectManager->create(\Magento\Quote\Model\Quote::class); +$quote->load('test_cart_with_bundle_and_options', 'reserved_order_id'); +$quote->delete(); + +/** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ +$quoteIdMask = $objectManager->create(\Magento\Quote\Model\QuoteIdMask::class); +$quoteIdMask->delete($quote->getId()); + +require __DIR__ . 'product_with_multiple_options_rollback.php'; + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php index 02a4ba4c282a0..98826adeb2147 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Condition/ProductTest.php @@ -58,6 +58,28 @@ public function testValidateCategorySalesRuleIncludesChildren($categoryId, $expe $this->assertEquals($expectedResult, $rule->validate($quote)); } + /** + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/Bundle/_files/order_item_with_bundle_and_options.php + * @magentoDataFixture Magento/SalesRule/_files/rules_sku_exclude.php + * + * @return void + */ + public function testValidateSalesRuleExcludesBundleChildren(): void + { + // Load the quote that contains a child of a bundle product + /** @var \Magento\Quote\Model\Quote $quote */ + $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class) + ->load('test_cart_with_bundle_and_options', 'reserved_order_id'); + + // Load the SalesRule looking for excluding products with selected sku + /** @var $rule \Magento\SalesRule\Model\Rule */ + $rule = $this->objectManager->get(\Magento\Framework\Registry::class) + ->registry('_fixture/Magento_SalesRule_Sku_Exclude'); + + $this->assertEquals(false, $rule->validate($quote)); + } + /** * @return array */ diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude.php new file mode 100644 index 0000000000000..9c2b4c289e4ae --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +/** @var \Magento\Eav\Api\AttributeRepositoryInterface $repository */ +$repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Eav\Api\AttributeRepositoryInterface::class); + +/** @var \Magento\Eav\Api\Data\AttributeInterface $skuAttribute */ +$skuAttribute = $repository->get( + 'catalog_product', + 'sku' +); +$data = $skuAttribute->getData(); +$data['is_used_for_promo_rules'] = 1; +$skuAttribute->setData($data); +$skuAttribute->save(); + +/** @var \Magento\SalesRule\Model\Rule $rule */ +$salesRule = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\SalesRule\Model\Rule::class); +$salesRule->setData( + [ + 'name' => '20% Off', + 'is_active' => 1, + 'customer_group_ids' => [\Magento\Customer\Model\GroupManagement::NOT_LOGGED_IN_ID], + 'coupon_type' => \Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON, + 'simple_action' => 'by_percent', + 'discount_amount' => 20, + 'discount_step' => 0, + 'stop_rules_processing' => 1, + 'website_ids' => [ + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + \Magento\Store\Model\StoreManagerInterface::class + )->getWebsite()->getId() + ], + ] +); + +$salesRule->getConditions()->loadArray([ + 'type' => \Magento\SalesRule\Model\Rule\Condition\Combine::class, + 'attribute' => null, + 'operator' => null, + 'value' => '1', + 'is_value_processed' => null, + 'aggregator' => 'all', + 'conditions' => + [ + [ + 'type' => \Magento\SalesRule\Model\Rule\Condition\Product\Found::class, + 'attribute' => null, + 'operator' => null, + 'value' => '1', + 'is_value_processed' => null, + 'aggregator' => 'all', + 'conditions' => + [ + [ + 'type' => \Magento\SalesRule\Model\Rule\Condition\Product::class, + 'attribute' => 'sku', + 'operator' => '!=', + 'value' => 'product-bundle', + 'is_value_processed' => false, + ], + ], + ], + ], +]); + +$salesRule->save(); + +/** @var Magento\Framework\Registry $registry */ +$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class); + +$registry->unregister('_fixture/Magento_SalesRule_Sku_Exclude'); +$registry->register('_fixture/Magento_SalesRule_Sku_Exclude', $salesRule); diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude_rollback.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude_rollback.php new file mode 100644 index 0000000000000..79ec3259fd86a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude_rollback.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +/** @var \Magento\Eav\Api\AttributeRepositoryInterface $repository */ +$repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Eav\Api\AttributeRepositoryInterface::class); + +/** @var \Magento\Eav\Api\Data\AttributeInterface $skuAttribute */ +$skuAttribute = $repository->get( + 'catalog_product', + 'sku' +); +$data = $skuAttribute->getData(); +$data['is_used_for_promo_rules'] = 0; +$skuAttribute->setData($data); +$skuAttribute->save(); + +/** @var Magento\Framework\Registry $registry */ +$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class); + +/** @var Magento\SalesRule\Model\Rule $rule */ +$rule = $registry->registry('_fixture/Magento_SalesRule_Sku_Exclude'); + +$rule->delete(); From eb7d034353e4cdfb245a6adff5ac7b6dc1f74b74 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Wed, 6 Jun 2018 10:40:10 -0500 Subject: [PATCH 057/133] MAGETWO-91529: Restricted admin user can remove product from other websites - Disable fields for locked attributes --- .../Form/Modifier/AbstractModifierTest.php | 6 +- .../Form/Modifier/AttributeSetTest.php | 23 ++++++- .../Product/Form/Modifier/CategoriesTest.php | 38 ++++++++++ .../Product/Form/Modifier/EavTest.php | 69 ++++++++++++++++--- .../Product/Form/Modifier/GeneralTest.php | 3 + .../Modifier/ScheduleDesignUpdateTest.php | 3 + .../Product/Form/Modifier/WebsitesTest.php | 14 ++-- .../Product/Form/Modifier/AdvancedPricing.php | 3 +- .../Product/Form/Modifier/AttributeSet.php | 1 + .../Product/Form/Modifier/Categories.php | 1 + .../Product/Form/Modifier/Eav.php | 7 +- .../Product/Form/Modifier/General.php | 5 +- .../Product/Form/Modifier/Websites.php | 2 +- .../Form/Modifier/AdvancedInventory.php | 1 + 14 files changed, 147 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php index af10eeea42fd3..473f1aea33618 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php @@ -63,7 +63,8 @@ protected function setUp() 'getAttributes', 'getStore', 'getAttributeDefaultValue', - 'getExistsStoreValueFlag' + 'getExistsStoreValueFlag', + 'isLockedAttribute' ])->getMockForAbstractClass(); $this->storeMock = $this->getMockBuilder(StoreInterface::class) ->setMethods(['load', 'getId', 'getConfig']) @@ -81,9 +82,6 @@ protected function setUp() $this->arrayManagerMock->expects($this->any()) ->method('set') ->willReturnArgument(1); - $this->arrayManagerMock->expects($this->any()) - ->method('merge') - ->willReturnArgument(1); $this->arrayManagerMock->expects($this->any()) ->method('remove') ->willReturnArgument(1); diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php index c22dde0b456ac..6deb154d02a83 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php @@ -5,6 +5,7 @@ */ namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier; +use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AttributeSet; use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory; use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection; @@ -84,7 +85,27 @@ protected function createModel() public function testModifyMeta() { - $this->assertNotEmpty($this->getModel()->modifyMeta(['test_group' => []])); + $modifyMeta = $this->getModel()->modifyMeta(['test_group' => []]); + $this->assertNotEmpty($modifyMeta); + } + + /** + * @param bool $locked + * @dataProvider modifyMetaLockedDataProvider + */ + public function testModifyMetaLocked($locked) + { + $this->productMock->expects($this->any()) + ->method('isLockedAttribute') + ->willReturn($locked); + $modifyMeta = $this->getModel()->modifyMeta([AbstractModifier::DEFAULT_GENERAL_PANEL => []]); + $this->assertEquals($locked, + $modifyMeta[AbstractModifier::DEFAULT_GENERAL_PANEL]['children']['attribute_set_id']['arguments']['data']['config']['disabled']); + } + + public function modifyMetaLockedDataProvider() + { + return [[true], [false]]; } public function testModifyMetaToBeEmpty() diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php index 4daff7e7930e3..5f5913c20209a 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php @@ -114,6 +114,44 @@ public function testModifyMeta() $this->assertArrayHasKey($groupCode, $this->getModel()->modifyMeta($meta)); } + /** + * @param bool $locked + * @dataProvider modifyMetaLockedDataProvider + */ + public function testModifyMetaLocked($locked) + { + $groupCode = 'test_group_code'; + $meta = [ + $groupCode => [ + 'children' => [ + 'category_ids' => [ + 'sortOrder' => 10, + ], + ], + ], + ]; + + $this->arrayManagerMock->expects($this->any()) + ->method('findPath') + ->willReturn('path'); + + $this->productMock->expects($this->any()) + ->method('isLockedAttribute') + ->willReturn($locked); + + $this->arrayManagerMock->expects($this->any()) + ->method('merge') + ->willReturnArgument(2); + + $modifyMeta = $this->createModel()->modifyMeta($meta); + $this->assertEquals($locked, $modifyMeta['arguments']['data']['config']['disabled']); + } + + public function modifyMetaLockedDataProvider() + { + return [[true], [false]]; + } + public function testModifyMetaWithCaching() { $this->arrayManagerMock->expects($this->exactly(2)) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php index a29379647b9e1..eb9035ed9938f 100755 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php @@ -456,13 +456,13 @@ public function testModifyData() * @param string $attrValue * @param string $note * @param array $expected + * @param bool $locked * @covers \Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav::isProductExists * @covers \Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav::setupAttributeMeta * @dataProvider setupAttributeMetaDataProvider */ - public function testSetupAttributeMetaDefaultAttribute($productId, $productRequired, $attrValue, $note, $expected) + public function testSetupAttributeMetaDefaultAttribute($productId, $productRequired, $attrValue, $note, $expected, $locked = false) { - $configPath = 'arguments/data/config'; $groupCode = 'product-details'; $sortOrder = '0'; @@ -470,6 +470,10 @@ public function testSetupAttributeMetaDefaultAttribute($productId, $productRequi ->method('getId') ->willReturn($productId); + $this->productMock->expects($this->any()) + ->method('isLockedAttribute') + ->willReturn($locked); + $this->productAttributeMock->expects($this->any()) ->method('getIsRequired') ->willReturn($productRequired); @@ -509,12 +513,7 @@ public function testSetupAttributeMetaDefaultAttribute($productId, $productRequi $this->arrayManagerMock->expects($this->any()) ->method('set') - ->with( - $configPath, - [], - $expected - ) - ->willReturn($expected); + ->willReturnArgument(2); $this->arrayManagerMock->expects($this->any()) ->method('merge') @@ -540,8 +539,10 @@ public function setupAttributeMetaDataProvider() { return [ 'default_null_prod_not_new_and_required' => $this->defaultNullProdNotNewAndRequired(), + 'default_null_prod_not_new_locked_and_required' => $this->defaultNullProdNotNewLockedAndRequired(), 'default_null_prod_not_new_and_not_required' => $this->defaultNullProdNotNewAndNotRequired(), 'default_null_prod_new_and_not_required' => $this->defaultNullProdNewAndNotRequired(), + 'default_null_prod_new_locked_and_not_required' => $this->defaultNullProdNewLOckedAndNotRequired(), 'default_null_prod_new_and_required' => $this->defaultNullProdNewAndRequired(), 'default_null_prod_new_and_required_and_filled_notice' => $this->defaultNullProdNewAndRequiredAndFilledNotice() @@ -575,6 +576,32 @@ private function defaultNullProdNotNewAndRequired() ]; } + private function defaultNullProdNotNewLockedAndRequired() + { + return [ + 'productId' => 1, + 'productRequired' => true, + 'attrValue' => 'val', + 'note' => null, + 'expected' => [ + 'dataType' => null, + 'formElement' => null, + 'visible' => null, + 'required' => true, + 'notice' => null, + 'default' => null, + 'label' => new Phrase('mylabel'), + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0, + 'disabled' => true, + ], + 'locked' => true + ]; + } + /** * @return array */ @@ -629,6 +656,32 @@ private function defaultNullProdNewAndNotRequired() ]; } + private function defaultNullProdNewLockedAndNotRequired() + { + return [ + 'productId' => null, + 'productRequired' => false, + 'attrValue' => null, + 'note' => null, + 'expected' => [ + 'dataType' => null, + 'formElement' => null, + 'visible' => null, + 'required' => false, + 'notice' => null, + 'default' => 'required_value', + 'label' => new Phrase('mylabel'), + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0, + 'disabled' => true, + ], + 'locked' => true, + ]; + } + /** * @return array */ diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/GeneralTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/GeneralTest.php index 78502ae297b52..a9d717db7b7f9 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/GeneralTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/GeneralTest.php @@ -60,6 +60,9 @@ protected function createModel() public function testModifyMeta() { + $this->arrayManagerMock->expects($this->any()) + ->method('merge') + ->willReturnArgument(2); $this->assertNotEmpty($this->getModel()->modifyMeta([ 'first_panel_code' => [ 'arguments' => [ diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ScheduleDesignUpdateTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ScheduleDesignUpdateTest.php index d4d4136bf4157..783c6247b9df3 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ScheduleDesignUpdateTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ScheduleDesignUpdateTest.php @@ -24,6 +24,9 @@ protected function createModel() public function testModifyMeta() { + $this->arrayManagerMock->expects($this->any()) + ->method('merge') + ->willReturnArgument(1); $this->assertSame([], $this->getModel()->modifyMeta([])); } diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/WebsitesTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/WebsitesTest.php index 997b66861c21b..c3096770729a6 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/WebsitesTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/WebsitesTest.php @@ -76,7 +76,10 @@ class WebsitesTest extends AbstractModifierTest protected function setUp() { - $this->objectManager = new ObjectManager($this); + parent::setUp(); + $this->productMock->expects($this->any()) + ->method('getId') + ->willReturn(self::PRODUCT_ID); $this->assignedWebsites = [self::SECOND_WEBSITE_ID]; $this->websiteMock = $this->getMockBuilder(\Magento\Store\Model\Website::class) ->setMethods(['getId', 'getName']) @@ -101,15 +104,9 @@ protected function setUp() $this->storeRepositoryMock = $this->getMockBuilder(\Magento\Store\Api\StoreRepositoryInterface::class) ->setMethods(['getList']) ->getMockForAbstractClass(); - $this->locatorMock = $this->getMockBuilder(\Magento\Catalog\Model\Locator\LocatorInterface::class) - ->setMethods(['getProduct', 'getWebsiteIds']) - ->getMockForAbstractClass(); $this->productMock = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class) ->setMethods(['getId']) ->getMockForAbstractClass(); - $this->locatorMock->expects($this->any()) - ->method('getProduct') - ->willReturn($this->productMock); $this->locatorMock->expects($this->any()) ->method('getWebsiteIds') ->willReturn($this->assignedWebsites); @@ -148,9 +145,6 @@ protected function setUp() $this->storeRepositoryMock->expects($this->any()) ->method('getList') ->willReturn([$this->storeViewMock]); - $this->productMock->expects($this->any()) - ->method('getId') - ->willReturn(self::PRODUCT_ID); $this->secondWebsiteMock->expects($this->any()) ->method('getId') ->willReturn($this->assignedWebsites[0]); diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php index a8378c364a63e..c5c3c6666c54b 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php @@ -432,7 +432,8 @@ private function getTierPriceStructure($tierPricePath) 'dndConfig' => [ 'enabled' => false, ], - 'disabled' => false, + 'disabled' => + $this->arrayManager->get($tierPricePath . '/arguments/data/config/disabled', $this->meta), 'required' => false, 'sortOrder' => $this->arrayManager->get($tierPricePath . '/arguments/data/config/sortOrder', $this->meta), diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AttributeSet.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AttributeSet.php index a1aacc91f2e47..0733d21bf47d7 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AttributeSet.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AttributeSet.php @@ -108,6 +108,7 @@ public function modifyMeta(array $meta) self::ATTRIBUTE_SET_FIELD_ORDER ), 'multiple' => false, + 'disabled' => $this->locator->getProduct()->isLockedAttribute('attribute_set_id'), ]; } diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index 7456c1bfef91f..ed737df708ab8 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -228,6 +228,7 @@ protected function customizeCategoriesField(array $meta) 'componentType' => 'container', 'component' => 'Magento_Ui/js/form/components/group', 'scopeLabel' => __('[GLOBAL]'), + 'disabled' => $this->locator->getProduct()->isLockedAttribute($fieldCode), ], ], ], diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php index b216ee8c9c547..3457cad0ccec2 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php @@ -593,6 +593,7 @@ private function isProductExists() public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupCode, $sortOrder) { $configPath = ltrim(static::META_CONFIG_PATH, ArrayManager::DEFAULT_PATH_DELIMITER); + $attributeCode = $attribute->getAttributeCode(); $meta = $this->arrayManager->set($configPath, [], [ 'dataType' => $attribute->getFrontendInput(), 'formElement' => $this->getFormElementsMapValue($attribute->getFrontendInput()), @@ -601,7 +602,7 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC 'notice' => $attribute->getNote() === null ? null : __($attribute->getNote()), 'default' => (!$this->isProductExists()) ? $this->getAttributeDefaultValue($attribute) : null, 'label' => __($attribute->getDefaultFrontendLabel()), - 'code' => $attribute->getAttributeCode(), + 'code' => $attributeCode, 'source' => $groupCode, 'scopeLabel' => $this->getScopeLabel($attribute), 'globalScope' => $this->isScopeGlobal($attribute), @@ -630,7 +631,9 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC ]); } - if (in_array($attribute->getAttributeCode(), $this->attributesToDisable)) { + $product = $this->locator->getProduct(); + if (in_array($attributeCode, $this->attributesToDisable) + || $product->isLockedAttribute($attributeCode)) { $meta = $this->arrayManager->merge($configPath, $meta, [ 'disabled' => true, ]); diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index 03d4dde311491..b5ab2e9b5d730 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -203,7 +203,7 @@ protected function customizeStatusField(array $meta) protected function customizeWeightField(array $meta) { $weightPath = $this->arrayManager->findPath(ProductAttributeInterface::CODE_WEIGHT, $meta, null, 'children'); - + $disabled = $this->arrayManager->get($weightPath . '/arguments/data/config/disabled', $meta); if ($weightPath) { $meta = $this->arrayManager->merge( $weightPath . static::META_CONFIG_PATH, @@ -215,7 +215,7 @@ protected function customizeWeightField(array $meta) ], 'additionalClasses' => 'admin__field-small', 'addafter' => $this->locator->getStore()->getConfig('general/locale/weight_unit'), - 'imports' => [ + 'imports' => $disabled ? [] : [ 'disabled' => '!${$.provider}:' . self::DATA_SCOPE_PRODUCT . '.product_has_weight:value' ] @@ -255,6 +255,7 @@ protected function customizeWeightField(array $meta) ], ], 'value' => (int)$this->locator->getProduct()->getTypeInstance()->hasWeight(), + 'disabled' => $disabled, ] ); } diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php index 298da3d5cd6f2..bab36ce5fc4d8 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php @@ -135,7 +135,6 @@ public function modifyMeta(array $meta) 'collapsible' => true, 'componentType' => Form\Fieldset::NAME, 'dataScope' => self::DATA_SCOPE_PRODUCT, - 'disabled' => false, 'sortOrder' => $this->getNextGroupSortOrder( $meta, 'search-engine-optimization', @@ -196,6 +195,7 @@ protected function getFieldsForFieldset() 'false' => '0', ], 'value' => $isChecked ? (string)$website['id'] : '0', + 'disabled' => $this->locator->getProduct()->isLockedAttribute('website_ids'), ], ], ], diff --git a/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php b/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php index d15f17530ffbc..7386f133b569a 100644 --- a/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php +++ b/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php @@ -223,6 +223,7 @@ private function prepareMeta() $this->arrayManager->slicePath($pathField, 0, -2) . '/arguments/data/config/sortOrder', $this->meta ) - 1, + 'disabled' => $this->locator->getProduct()->isLockedAttribute($fieldCode), ]; $qty['arguments']['data']['config'] = [ 'component' => 'Magento_CatalogInventory/js/components/qty-validator-changer', From 52a0efe2a91909801e740279e54b9943cb705147 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Fri, 1 Jun 2018 12:52:19 -0500 Subject: [PATCH 058/133] MAGETWO-91595: Image doesn't load on frontend PDP if the product name contains double quote " --- .../ActionGroup/AdminProductActionGroup.xml | 4 +- .../Catalog/Data/ProductData.xml | 13 ++++ .../Section/AdminProductImagesSection.xml | 1 + .../StorefrontCategoryProductSection.xml | 1 + .../StorefrontProductInfoMainSection.xml | 1 + .../StorefrontProductNameWithDoubleQuote.xml | 63 +++++++++++++++++++ 6 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontProductNameWithDoubleQuote.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml index c4843260f9310..0f57890af982a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml @@ -83,8 +83,8 @@ <waitForPageLoad time="30" stepKey="waitForPageRefresh"/> <waitForElementVisible selector="{{AdminProductImagesSection.imageUploadButton}}" stepKey="seeImageSectionIsReady"/> <attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/> - <waitForAjaxLoad time="30" stepKey="waitForAjaxUpload"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoading"/> + <waitForElementNotVisible selector="{{AdminProductImagesSection.uploadProgressBar}}" stepKey="waitForUpload"/> + <waitForElementVisible selector="{{AdminProductImagesSection.imageFile(image.fileName)}}" stepKey="waitForThumbnail"/> </actionGroup> <!--Remove image for product--> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml index 34110d0417661..e88b021e927a2 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml @@ -160,6 +160,7 @@ <data key="file_type">Upload File</data> <data key="shareable">Yes</data> <data key="file">magento-logo.png</data> + <data key="fileName">magento-logo</data> </entity> <entity name="MagentoLogo" type="image"> <data key="title" unique="suffix">MagentoLogo</data> @@ -281,4 +282,16 @@ <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> <requiredEntity type="custom_attribute_array">ApiProductNewsFromDate</requiredEntity> </entity> + <entity name="SimpleProductNameWithDoubleQuote" type="product"> + <data key="name" unique="prefix">Double Quote"</data> + <data key="sku" unique="prefix">doubleQuote</data> + <data key="type_id">simple</data> + <data key="attribute_set_id">4</data> + <data key="price">10.00</data> + <data key="visibility">4</data> + <data key="status">1</data> + <data key="quantity">1000</data> + <data key="weight">1</data> + <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> + </entity> </entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductImagesSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductImagesSection.xml index a9749ac677964..b31bcaf04e4b6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductImagesSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductImagesSection.xml @@ -14,5 +14,6 @@ <element name="imageUploadButton" type="button" selector="div.image div.fileinput-button"/> <element name="imageFile" type="text" selector="//*[@id='media_gallery_content']//img[contains(@src, '{{url}}')]" parameterized="true"/> <element name="removeImageButton" type="button" selector=".action-remove"/> + <element name="uploadProgressBar" type="text" selector=".uploader .file-row"/> </section> </sections> \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryProductSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryProductSection.xml index e736378ca8ca0..e8df8650e8dd8 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryProductSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontCategoryProductSection.xml @@ -19,5 +19,6 @@ <element name="ProductImageByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//img[@class='product-image-photo']" parameterized="true"/> <element name="ProductInfoByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//div[@class='product-item-info']" parameterized="true"/> <element name="ProductAddToCompareByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//a[contains(@class, 'tocompare')]" parameterized="true"/> + <element name="ProductImageByNameAndSrc" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//img[contains(@src, '{{src}}')]" parameterized="true"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml index 5abc388a7d65d..e88888d50d45f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml @@ -18,6 +18,7 @@ <element name="oldPrice" type="text" selector=".old-price"/> <element name="productStockStatus" type="text" selector=".stock[title=Availability]>span"/> <element name="productImage" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[@class='fotorama__img']"/> + <element name="productImageSrc" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[contains(@src, '{{src}}')]" parameterized="true"/> <element name="productDescription" type="text" selector="#description .value"/> <element name="productOptionFieldInput" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//input[@type='text']" parameterized="true"/> <element name="productOptionAreaInput" type="textarea" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//textarea" parameterized="true"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontProductNameWithDoubleQuote.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontProductNameWithDoubleQuote.xml new file mode 100644 index 0000000000000..6c6d3961e915c --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontProductNameWithDoubleQuote.xml @@ -0,0 +1,63 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="StorefrontProductNameWithDoubleQuote"> + <annotations> + <title value="Product with double quote in name"/> + <description value="Product with a double quote in the name should appear correctly on the storefront"/> + <severity value="CRITICAL"/> + <group value="product"/> + <testCaseId value="MAGETWO-92384"/> + </annotations> + <before> + <createData entity="_defaultCategory" stepKey="createCategory"/> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + </after> + + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!--Create product via admin--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPage"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToProductCreatePage"> + <argument name="product" value="SimpleProductNameWithDoubleQuote"/> + </actionGroup> + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> + <argument name="product" value="SimpleProductNameWithDoubleQuote"/> + </actionGroup> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="selectCategory"/> + <actionGroup ref="addProductImage" stepKey="addImageToProduct"> + <argument name="image" value="ImageUpload"/> + </actionGroup> + <actionGroup ref="saveProductForm" stepKey="saveProduct"/> + + <!--Check product in category listing--> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="goToCategoryPage"/> + <seeElement selector="{{StorefrontCategoryProductSection.ProductImageByNameAndSrc(SimpleProductNameWithDoubleQuote.name, ImageUpload.fileName)}}" stepKey="seeCorrectImageCategoryPage"/> + <see selector="{{StorefrontCategoryProductSection.ProductTitleByName(SimpleProductNameWithDoubleQuote.name)}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectNameCategoryPage"/> + <see selector="{{StorefrontCategoryProductSection.ProductPriceByName(SimpleProductNameWithDoubleQuote.name)}}" userInput="${{SimpleProductNameWithDoubleQuote.price}}" stepKey="seeCorrectPriceCategoryPage"/> + <!--Open product display page--> + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName(SimpleProductNameWithDoubleQuote.name)}}" stepKey="clickProductToGoProductPage"/> + <waitForPageLoad stepKey="waitForProductDisplayPageLoad"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectName"/> + <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{SimpleProductNameWithDoubleQuote.sku}}" stepKey="seeCorrectSku"/> + <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="${{SimpleProductNameWithDoubleQuote.price}}" stepKey="seeCorrectPrice"/> + <seeElement selector="{{StorefrontProductInfoMainSection.productImageSrc(ImageUpload.fileName)}}" stepKey="seeCorrectImage"/> + <see selector="{{StorefrontProductInfoMainSection.stock}}" userInput="In Stock" stepKey="seeInStock"/> + <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$createCategory.name$$" stepKey="seeCorrectBreadCrumbCategory"/> + <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectBreadCrumbProduct"/> + + <!--Remove product--> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <argument name="product" value="SimpleProductNameWithDoubleQuote"/> + </actionGroup> + </test> +</tests> From 0d1f0500ea3d06a3dc3a83a8c2bd844555b04e67 Mon Sep 17 00:00:00 2001 From: Sergii Kovalenko <skovalenko@magento.com> Date: Mon, 21 May 2018 19:05:28 +0300 Subject: [PATCH 059/133] MAGETWO-91595: Image doesn't load on frontend PDP if the product name contains double quote " --- .../Catalog/view/frontend/templates/product/breadcrumbs.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/breadcrumbs.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/breadcrumbs.phtml index 528b2b5c59f23..063f8857329e5 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/breadcrumbs.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/breadcrumbs.phtml @@ -11,7 +11,7 @@ $viewModel = $block->getData('viewModel'); "breadcrumbs": { "categoryUrlSuffix": "<?= $block->escapeHtml($viewModel->getCategoryUrlSuffix()); ?>", "useCategoryPathInUrl": <?= (int)$viewModel->isCategoryUsedInProductUrl(); ?>, - "product": "<?= $block->escapeHtml($block->escapeJsQuote($viewModel->getProductName(), '"')); ?>" + "product": "<?= $block->escapeHtml($block->escapeJs($viewModel->getProductName())); ?>" } }'> </div> From cb875104a5a6c2307417ae3a124453c50083479c Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 1 Jun 2018 11:06:10 -0500 Subject: [PATCH 060/133] MC-234: Admin should be able to create category from the product page - Added test for customer view --- .../Catalog/ActionGroup/AdminCategoryActionGroup.xml | 12 ++++++++++-- .../Section/AdminProductCategoryCreationSection.xml | 1 - .../Test/AdminCreateCategoryFromProductPage.xml | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index 006c7ff7beb7d..e2d2f65930b73 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -148,6 +148,11 @@ <!-- Actions to delete the category last made --> <actionGroup name="DeleteMostRecentCategory"> + + <amOnPage url="/{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/> + + <waitForPageLoad stepKey="waitForCategoryPageLoad"/> + <click stepKey="goToCreateCategory" selector="{{AdminProductCategoryCreationSection.lastCreatedCategory}}" /> <waitForPageLoad stepKey="waitForCreatedCategoryPageLoad"/> @@ -166,10 +171,13 @@ <argument name="categoryName" defaultValue="Test Category" type="string"/> </arguments> - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/> + <amOnPage url="/{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <see selector="{{AdminProductCategoryCreationSection.categoryStructure}}" userInput="{{categoryName}}" stepKey="assertCategoryOnStorefront"/> + <see userInput="{{categoryName}}" stepKey="assertCategoryOnStorefront"/> + + <amOnPage url="/{{categoryName}}.html" stepKey="goToCustomerFrontPage"/> + <waitForPageLoad stepKey="waitForCustomerCategoryPageLoad"/> </actionGroup> <!--Check that name field is required--> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml index a983a7f24f803..d5927d597a3fd 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml @@ -18,7 +18,6 @@ <element name="parentCategoryDropdownDefaultOption" type="block" selector=".product_form_product_form_create_category_modal .action-menu-item._expended .admin__action-multiselect-label" /> <element name="createCategory" type="button" selector="#save" /> - <element name="categoryStructure" type="button" selector="#ext-gen5" /> <element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" /> <element name="categoryDeleteButton" type="button" selector="//button/span[text()='Delete']" /> <element name="acceptDeletion" type="button" selector="//button/span[text()='OK']" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml index 7986f055cbb3c..543ebcfc7a870 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml @@ -29,12 +29,12 @@ <!-- Create new category in the product page with the category of AdminCreateCategoryFromProductPage --> <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> - <argument name="categoryName" value="AdminCreateCategoryFromProductPage" /> + <argument name="categoryName" value="admincreatecategoryfromproductpage" /> </actionGroup> <!-- Check that category was created --> <actionGroup ref="CategoryPresent" stepKey="checkIfCategoryPresent"> - <argument name="categoryName" value="AdminCreateCategoryFromProductPage" /> + <argument name="categoryName" value="admincreatecategoryfromproductpage" /> </actionGroup> <!-- Delete the created category --> From c45b9f2b71bb078ae2adcefaf4034796286dac28 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 1 Jun 2018 11:49:03 -0500 Subject: [PATCH 061/133] MC-234: Admin should be able to create category from the product page - Fixed some conventions and assert success message seen. Also check that there is not a 404 error --- .../ActionGroup/AdminCategoryActionGroup.xml | 14 +++++++++++++- .../AdminProductCategoryCreationSection.xml | 2 ++ ... => AdminCreateCategoryFromProductPageTest.xml} | 7 +++---- 3 files changed, 18 insertions(+), 5 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/{AdminCreateCategoryFromProductPage.xml => AdminCreateCategoryFromProductPageTest.xml} (89%) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index e2d2f65930b73..8797e56010259 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -144,6 +144,14 @@ <click stepKey="clickDefaultParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategoryDropdownDefaultOption}}" /> <click stepKey="createCategory" selector="{{AdminProductCategoryCreationSection.createCategory}}" /> + + <waitForPageLoad stepKey="waitForCategoryCreated"/> + + <click stepKey="saveProduct" selector="{{AdminProductCategoryCreationSection.saveButton}}" /> + + <waitForPageLoad stepKey="waitForChangesSaved"/> + + <seeElement selector="{{AdminProductCategoryCreationSection.successMessage}}" stepKey="assertSuccess"/> </actionGroup> <!-- Actions to delete the category last made --> @@ -171,12 +179,16 @@ <argument name="categoryName" defaultValue="Test Category" type="string"/> </arguments> - <amOnPage url="/{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/> <waitForPageLoad stepKey="waitForCategoryPageLoad"/> <see userInput="{{categoryName}}" stepKey="assertCategoryOnStorefront"/> <amOnPage url="/{{categoryName}}.html" stepKey="goToCustomerFrontPage"/> + + <see userInput="{{categoryName}}" stepKey="assertCategoryNameOnStorefront"/> + <see userInput="Compare Products" stepKey="assertCategoryPageShowsUp"/> + <waitForPageLoad stepKey="waitForCustomerCategoryPageLoad"/> </actionGroup> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml index d5927d597a3fd..c3d3d1e059ecf 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml @@ -17,6 +17,8 @@ <element name="parentCategory" type="block" selector=".product_form_product_form_create_category_modal div[data-role='selected-option']" /> <element name="parentCategoryDropdownDefaultOption" type="block" selector=".product_form_product_form_create_category_modal .action-menu-item._expended .admin__action-multiselect-label" /> <element name="createCategory" type="button" selector="#save" /> + <element name="saveButton" type="button" selector="#save-button" /> + <element name="successMessage" type="block" selector=".success" /> <element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" /> <element name="categoryDeleteButton" type="button" selector="//button/span[text()='Delete']" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml similarity index 89% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml index 543ebcfc7a870..91f3f298a3476 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml @@ -18,8 +18,7 @@ <group value="Catalog" /> </annotations> <before> - <createData entity="SimpleTwo" stepKey="simpleProduct"> - </createData> + <createData entity="SimpleTwo" stepKey="simpleProduct" /> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> @@ -29,12 +28,12 @@ <!-- Create new category in the product page with the category of AdminCreateCategoryFromProductPage --> <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> - <argument name="categoryName" value="admincreatecategoryfromproductpage" /> + <argument name="categoryName" value="{{_defaultCategory.name}}" /> </actionGroup> <!-- Check that category was created --> <actionGroup ref="CategoryPresent" stepKey="checkIfCategoryPresent"> - <argument name="categoryName" value="admincreatecategoryfromproductpage" /> + <argument name="categoryName" value="{{_defaultCategory.name}}" /> </actionGroup> <!-- Delete the created category --> From e0e4003b213d4fc47e18b2eae2a13fa506327714 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 1 Jun 2018 16:28:54 -0500 Subject: [PATCH 062/133] MC-234: Admin should be able to create category from the product page - Put elements in more appropriate sections --- .../Catalog/ActionGroup/AdminCategoryActionGroup.xml | 10 +++++----- .../Section/AdminCategoryMainActionsSection.xml | 4 ++++ .../Section/AdminProductCategoryCreationSection.xml | 6 +----- .../Catalog/Section/AdminProductFormSection.xml | 1 + 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index 8797e56010259..9ddb25ca6d440 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -147,11 +147,11 @@ <waitForPageLoad stepKey="waitForCategoryCreated"/> - <click stepKey="saveProduct" selector="{{AdminProductCategoryCreationSection.saveButton}}" /> + <click stepKey="saveProduct" selector="{{AdminProductFormSection.saveButton}}" /> <waitForPageLoad stepKey="waitForChangesSaved"/> - <seeElement selector="{{AdminProductCategoryCreationSection.successMessage}}" stepKey="assertSuccess"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/> </actionGroup> <!-- Actions to delete the category last made --> @@ -161,13 +161,13 @@ <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <click stepKey="goToCreateCategory" selector="{{AdminProductCategoryCreationSection.lastCreatedCategory}}" /> + <click stepKey="goToCreateCategory" selector="{{AdminCategoryMainActionsSection.lastCreatedCategory}}" /> <waitForPageLoad stepKey="waitForCreatedCategoryPageLoad"/> - <click stepKey="clickDeleteCategory" selector="{{AdminProductCategoryCreationSection.categoryDeleteButton}}" /> + <click stepKey="clickDeleteCategory" selector="{{AdminCategoryMainActionsSection.categoryDeleteButton}}" /> <waitForPageLoad stepKey="waitForModalVisible"/> - <click stepKey="clickOkToDelete" selector="{{AdminProductCategoryCreationSection.acceptDeletion}}" /> + <click stepKey="clickOkToDelete" selector="{{AdminCategoryMainActionsSection.acceptDeletion}}" /> <waitForPageLoad stepKey="waitForModalNotVisible"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml index 3c806fbbea63f..5928ec7a020c0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml @@ -11,5 +11,9 @@ <section name="AdminCategoryMainActionsSection"> <element name="SaveButton" type="button" selector=".page-actions-inner #save" timeout="30"/> <element name="DeleteButton" type="button" selector=".page-actions-inner #delete" timeout="30"/> + + <element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" /> + <element name="categoryDeleteButton" type="button" selector="//button/span[text()='Delete']" /> + <element name="acceptDeletion" type="button" selector="//button/span[text()='OK']" /> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml index c3d3d1e059ecf..b4e836ac253cf 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml @@ -17,11 +17,7 @@ <element name="parentCategory" type="block" selector=".product_form_product_form_create_category_modal div[data-role='selected-option']" /> <element name="parentCategoryDropdownDefaultOption" type="block" selector=".product_form_product_form_create_category_modal .action-menu-item._expended .admin__action-multiselect-label" /> <element name="createCategory" type="button" selector="#save" /> - <element name="saveButton" type="button" selector="#save-button" /> - <element name="successMessage" type="block" selector=".success" /> - <element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" /> - <element name="categoryDeleteButton" type="button" selector="//button/span[text()='Delete']" /> - <element name="acceptDeletion" type="button" selector="//button/span[text()='OK']" /> + </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml index 926d87e889931..fc7ea2ec5b4df 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml @@ -30,6 +30,7 @@ <element name="productFormTabState" type="text" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]/parent::*/parent::*[@data-state-collapsible='{{state}}']" parameterized="true"/> <element name="visibility" type="select" selector="//select[@name='product[visibility]']"/> <element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/> + <element name="saveButton" type="button" selector="#save-button" /> </section> <section name="ProductDesignSection"> <element name="DesignTab" type="button" selector="//strong[@class='admin__collapsible-title']//span[text()='Design']"/> From 08b118d44e48502df498bfd7a0d349d977dbd5d1 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 1 Jun 2018 16:58:23 -0500 Subject: [PATCH 063/133] MC-234: Admin should be able to create category from the product page - Move elements to the correct section and remove adding the product to the category --- .../Catalog/ActionGroup/AdminCategoryActionGroup.xml | 11 +++-------- .../Section/AdminCategoryMainActionsSection.xml | 4 ---- .../Section/AdminCategorySidebarTreeSection.xml | 2 ++ .../Catalog/Section/AdminProductFormSection.xml | 1 - 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index 9ddb25ca6d440..0a3235accd053 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -147,11 +147,6 @@ <waitForPageLoad stepKey="waitForCategoryCreated"/> - <click stepKey="saveProduct" selector="{{AdminProductFormSection.saveButton}}" /> - - <waitForPageLoad stepKey="waitForChangesSaved"/> - - <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/> </actionGroup> <!-- Actions to delete the category last made --> @@ -161,13 +156,13 @@ <waitForPageLoad stepKey="waitForCategoryPageLoad"/> - <click stepKey="goToCreateCategory" selector="{{AdminCategoryMainActionsSection.lastCreatedCategory}}" /> + <click stepKey="goToCreateCategory" selector="{{AdminCategorySidebarTreeSection.lastCreatedCategory}}" /> <waitForPageLoad stepKey="waitForCreatedCategoryPageLoad"/> - <click stepKey="clickDeleteCategory" selector="{{AdminCategoryMainActionsSection.categoryDeleteButton}}" /> + <click stepKey="clickDeleteCategory" selector="{{AdminCategoryMainActionsSection.DeleteButton}}" /> <waitForPageLoad stepKey="waitForModalVisible"/> - <click stepKey="clickOkToDelete" selector="{{AdminCategoryMainActionsSection.acceptDeletion}}" /> + <click stepKey="clickOkToDelete" selector="{{AdminCategoryModalSection.ok}}" /> <waitForPageLoad stepKey="waitForModalNotVisible"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml index 5928ec7a020c0..3c806fbbea63f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml @@ -11,9 +11,5 @@ <section name="AdminCategoryMainActionsSection"> <element name="SaveButton" type="button" selector=".page-actions-inner #save" timeout="30"/> <element name="DeleteButton" type="button" selector=".page-actions-inner #delete" timeout="30"/> - - <element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" /> - <element name="categoryDeleteButton" type="button" selector="//button/span[text()='Delete']" /> - <element name="acceptDeletion" type="button" selector="//button/span[text()='OK']" /> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySidebarTreeSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySidebarTreeSection.xml index e914c80c3e6ac..29f6f120c0f90 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySidebarTreeSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySidebarTreeSection.xml @@ -14,5 +14,7 @@ <element name="categoryTreeRoot" type="text" selector="div.x-tree-root-node>li.x-tree-node:first-of-type>div.x-tree-node-el:first-of-type" timeout="30"/> <element name="categoryInTree" type="text" selector="//a/span[contains(text(), '{{name}}')]" parameterized="true" timeout="30"/> <element name="categoryInTreeUnderRoot" type="text" selector="//div[@class='x-tree-root-node']/li/ul/li[@class='x-tree-node']/div/a/span[contains(text(), '{{name}}')]" parameterized="true"/> + <element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" /> + </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml index fc7ea2ec5b4df..926d87e889931 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml @@ -30,7 +30,6 @@ <element name="productFormTabState" type="text" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]/parent::*/parent::*[@data-state-collapsible='{{state}}']" parameterized="true"/> <element name="visibility" type="select" selector="//select[@name='product[visibility]']"/> <element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/> - <element name="saveButton" type="button" selector="#save-button" /> </section> <section name="ProductDesignSection"> <element name="DesignTab" type="button" selector="//strong[@class='admin__collapsible-title']//span[text()='Design']"/> From 0c2ff2b4ff2b8792f66ad36a47c38e902da6e038 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Mon, 4 Jun 2018 15:27:36 -0500 Subject: [PATCH 064/133] MC-234: Admin should be able to create category from the product page - Updated test to be more specific in selectors and name steps correctly --- .../ActionGroup/AdminCategoryActionGroup.xml | 9 ++++----- .../Section/AdminCategorySidebarTreeSection.xml | 2 +- .../AdminCreateCategoryFromProductPageTest.xml | 16 +++++++--------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index 0a3235accd053..2f7956b35733c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -174,15 +174,14 @@ <argument name="categoryName" defaultValue="Test Category" type="string"/> </arguments> - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryFrontPage"/> - <waitForPageLoad stepKey="waitForCategoryPageLoad"/> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryAdminPage"/> + <waitForPageLoad stepKey="waitForCategoryAdminPageLoad"/> - <see userInput="{{categoryName}}" stepKey="assertCategoryOnStorefront"/> + <see userInput="{{categoryName}}" stepKey="assertCategoryOnAdminPage" selector="{{AdminCategorySidebarTreeSection.treeContainer}}"/> <amOnPage url="/{{categoryName}}.html" stepKey="goToCustomerFrontPage"/> - <see userInput="{{categoryName}}" stepKey="assertCategoryNameOnStorefront"/> - <see userInput="Compare Products" stepKey="assertCategoryPageShowsUp"/> + <see userInput="{{categoryName}}" stepKey="assertCategoryNameOnStorefront" selector="{{StorefrontCategoryMainSection.CategoryTitle}}"/> <waitForPageLoad stepKey="waitForCustomerCategoryPageLoad"/> </actionGroup> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySidebarTreeSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySidebarTreeSection.xml index 29f6f120c0f90..5e080bbb7fdba 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySidebarTreeSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySidebarTreeSection.xml @@ -15,6 +15,6 @@ <element name="categoryInTree" type="text" selector="//a/span[contains(text(), '{{name}}')]" parameterized="true" timeout="30"/> <element name="categoryInTreeUnderRoot" type="text" selector="//div[@class='x-tree-root-node']/li/ul/li[@class='x-tree-node']/div/a/span[contains(text(), '{{name}}')]" parameterized="true"/> <element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" /> - + <element name="treeContainer" type="block" selector=".tree-holder" /> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml index 91f3f298a3476..33868546033bd 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml @@ -15,29 +15,27 @@ <description value="Admin should be able to create category from the product page" /> <severity value="AVERAGE" /> <testCaseId value="MC-234" /> - <group value="Catalog" /> + <group value="skrt" /> </annotations> <before> + <!-- Create new category in the product page with the category of AdminCreateCategoryFromProductPage --> <createData entity="SimpleTwo" stepKey="simpleProduct" /> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> + <argument name="categoryName" value="{{_defaultCategory.name}}" /> + </actionGroup> </before> <after> + <!-- Delete the created category --> + <actionGroup ref="DeleteMostRecentCategory" stepKey="getRidOfCreatedCategory" /> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> </after> - <!-- Create new category in the product page with the category of AdminCreateCategoryFromProductPage --> - <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> - <argument name="categoryName" value="{{_defaultCategory.name}}" /> - </actionGroup> - <!-- Check that category was created --> <actionGroup ref="CategoryPresent" stepKey="checkIfCategoryPresent"> <argument name="categoryName" value="{{_defaultCategory.name}}" /> </actionGroup> - <!-- Delete the created category --> - <actionGroup ref="DeleteMostRecentCategory" stepKey="getRidOfCreatedCategory" /> - </test> </tests> From 7da6a5a6eeaecb4dde516f52bc3d6b12abffddea Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Mon, 4 Jun 2018 15:35:23 -0500 Subject: [PATCH 065/133] MC-234: Admin should be able to create category from the product page - Change the group value back to the correct name --- .../Catalog/Test/AdminCreateCategoryFromProductPageTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml index 33868546033bd..92277ddccf9a9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml @@ -15,7 +15,7 @@ <description value="Admin should be able to create category from the product page" /> <severity value="AVERAGE" /> <testCaseId value="MC-234" /> - <group value="skrt" /> + <group value="Catalog" /> </annotations> <before> <!-- Create new category in the product page with the category of AdminCreateCategoryFromProductPage --> From fa3637cc9141dbf1614e5229314d10809cddb5a1 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Mon, 4 Jun 2018 15:55:22 -0500 Subject: [PATCH 066/133] MC-234: Admin should be able to create category from the product page - Move part of the code from the action group to the test page to make the action group more reuseable --- .../Catalog/ActionGroup/AdminCategoryActionGroup.xml | 9 +-------- .../Test/AdminCreateCategoryFromProductPageTest.xml | 10 ++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index 2f7956b35733c..caa92522914b1 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -119,19 +119,12 @@ </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"/> </arguments> - <!--Navigate to product page --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <waitForPageLoad stepKey="waitForProductIndexPage"/> - - <!-- Click first example product --> - <click stepKey="clickFirstExampleProduct" selector="{{AdminProductCategoryCreationSection.firstExampleProduct}}" /> - <waitForPageLoad stepKey="waitForSpecificProductPage"/> - <!-- Click on new Category --> <click stepKey="clickNewCategory" selector="{{AdminProductCategoryCreationSection.newCategory}}" /> <waitForPageLoad stepKey="waitForFieldSet"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml index 92277ddccf9a9..a5fe983aa5ad0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml @@ -21,6 +21,16 @@ <!-- Create new category in the product page with the category of AdminCreateCategoryFromProductPage --> <createData entity="SimpleTwo" stepKey="simpleProduct" /> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!--Navigate to product page --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPage"/> + + <!-- Click first example product --> + <click stepKey="clickFirstExampleProduct" selector="{{AdminProductCategoryCreationSection.firstExampleProduct}}" /> + <waitForPageLoad stepKey="waitForSpecificProductPage"/> + + <!-- Fill out the form for the new category --> <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> <argument name="categoryName" value="{{_defaultCategory.name}}" /> </actionGroup> From 622fa8da71419acc07b2b6a13918c064a3122109 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Wed, 6 Jun 2018 11:55:24 -0500 Subject: [PATCH 067/133] MC-179: Admin should be able to update existing attributes of a configurable product --- .../AdminProductGridActionGroup.xml | 17 +++ .../AdminProductAttributeSetSection.xml | 4 + .../StorefrontProductInfoMainSection.xml | 1 + ...ConfigurableProductUpdateAttributeTest.xml | 119 ++++++++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml index 6398010f06687..f995e2abed8df 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml @@ -132,6 +132,23 @@ <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> </actionGroup> + <!-- Find a product by filtering grid and clicking on it --> + <actionGroup name="findProductUsingProductGrid"> + <arguments> + <argument name="product"/> + </arguments> + <!--TODO use other action group for filtering grid when MQE-539 is implemented --> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> + <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad" /> + </actionGroup> + <!--Delete a product by filtering grid and using delete action--> <actionGroup name="deleteProductUsingProductGrid"> <arguments> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml index 19e59d1cd22e6..1892862593c60 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml @@ -17,4 +17,8 @@ <section name="Group"> <element name="FolderName" type="text" selector="//span[text()='{{var1}}']" parameterized="true"/> </section> + <section name="modifyAttributes"> + <element name="firstExistingAttribute" type="block" selector=".admin__field:nth-of-type(1) .admin__control-select"/> + <element name="secondAttributeOption" type="block" selector=".admin__field:nth-of-type(1) .admin__control-select option:nth-of-type(2)"/> + </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml index cebb76e68a6cc..67ba5362bc198 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml @@ -14,5 +14,6 @@ <element name="productAttributeOptions1" type="select" selector="#product-options-wrapper div[tabindex='0'] option"/> <element name="productAttributeOptionsSelectButton" type="select" selector="#product-options-wrapper .super-attribute-select"/> <element name="productAttributeOptionsError" type="text" selector="//div[@class='mage-error']"/> + <element name="firstAttributeOnPage" type="block" selector="tr:nth-of-type(1) .data"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml new file mode 100644 index 0000000000000..6abc4866bac8e --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -0,0 +1,119 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminConfigurableProductUpdateAttributeTest"> + <annotations> + <features value="ConfigurableProduct"/> + <stories value="Update Attribute"/> + <title value="Admin should be able to update existing attributes of a configurable product"/> + <description value="Admin should be able to update existing attributes of a configurable product"/> + <severity value="AVERAGE"/> + <testCaseId value="MC-84"/> + <group value="ConfigurableProduct"/> + </annotations> + + <before> + <!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. --> + <!-- Create the category the product will be a part of --> + <createData entity="ApiCategory" stepKey="createCategory"/> + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + + <!-- Create the two attributes the product will have --> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <!-- Add the product to the default set --> + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <!-- Get the two attributes --> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Create the two children product --> + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + </createData> + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + + <!-- Create the two configurable product with both children --> + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct1"/> + </createData> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct2"/> + </createData> + + <!-- login --> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + + <after> + <amOnPage url="admin/admin/auth/logout/" stepKey="logout"/> + + <!-- Delete everything that was created in the before block --> + <deleteData createDataKey="createCategory" stepKey="deleteCatagory" /> + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + </after> + + <!-- Get the current option of the attribute before it was changed --> + <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad" /> + <grabTextFrom stepKey="getBeforeOption" selector="{{StorefrontProductInfoMainSection.firstAttributeOnPage}}" /> + + <!-- Find the product that we just created using the product grid --> + <actionGroup ref="findProductUsingProductGrid" stepKey="goToCreatedProduct"> + <argument name="product" value="ApiConfigurableProduct" /> + </actionGroup> + + <!-- change the option on the first attribute --> + <click stepKey="clickFirstAttribute" selector="{{modifyAttributes.firstExistingAttribute}}" /> + <click stepKey="clickSecondAttributeOption" selector="{{modifyAttributes.secondAttributeOption}}" /> + + <!-- Save the product --> + <click stepKey="saveProductAttribute" selector="{{AdminProductFormActionSection.saveButton}}" /> + <waitForPageLoad stepKey="waitForProductSaved" /> + <see stepKey="assertSuccess" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." /> + + <!-- Go back to the configurable product page and check to see if it has changed --> + <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage2"/> + <waitForPageLoad stepKey="waitForProductPageLoad2" /> + <grabTextFrom stepKey="getCurrentOption" selector="{{StorefrontProductInfoMainSection.firstAttributeOnPage}}" /> + <assertNotEquals expected="{$getBeforeOption}" expectedType="string" actual="{$getCurrentOption}" actualType="string" stepKey="assertNotEquals"/> + + </test> +</tests> From 13b9bfa2f85e04a0248b2e39d07b4a267858b2a6 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Wed, 6 Jun 2018 14:23:50 -0500 Subject: [PATCH 068/133] MC-141: Guest customer should be able to advance search grouped product with product name MC-146: Guest customer should be able to advance search grouped product with product sku MC-282: Guest customer should be able to advance search grouped product with product description MC-283: Guest customer should be able to advance search grouped product with product short description MC-284: Guest customer should be able to advance search grouped product with product price - updated mftf tests --- .../AdvanceCatalogSearchBundleProductTest.xml | 137 +++++++++++++----- .../Catalog/Data/ProductData.xml | 25 ++++ .../Catalog/Metadata/product-meta.xml | 13 +- .../AdvanceCatalogSearchSimpleProductTest.xml | 87 ++++++++++- ...AdvanceCatalogSearchVirtualProductTest.xml | 48 ++++-- .../AdvanceCatalogSearchBundleProductTest.xml | 80 ---------- .../AdvanceCatalogSearchConfigurableTest.xml | 64 -------- ...ceCatalogSearchDownloadableProductTest.xml | 80 ---------- ...AdvanceCatalogSearchGroupedProductTest.xml | 80 ---------- .../AdvanceCatalogSearchSimpleProductTest.xml | 65 ++++----- ...AdvanceCatalogSearchVirtualProductTest.xml | 80 ---------- .../AdvanceCatalogSearchConfigurableTest.xml | 94 ++++++++---- ...ceCatalogSearchDownloadableProductTest.xml | 78 +++++++--- ...AdvanceCatalogSearchGroupedProductTest.xml | 107 +++++++++----- 14 files changed, 480 insertions(+), 558 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchBundleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchConfigurableTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchDownloadableProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchGroupedProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml index 375fe387ed424..44ae4b7476aeb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml @@ -10,142 +10,201 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdvanceCatalogSearchBundleByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> - <group value="Catalog"/> + <features value="Bundle"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product name"/> + <description value="Guest customer should be able to advance search Bundle product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-139"/> + <group value="Bundle"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiBundleProduct" stepKey="product"/> <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </getData> <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple1"/> </createData> <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple2"/> </createData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> + </after> </test> - <test name="AdvanceCatalogSearchBundleBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchBundleBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> <annotations> - <group value="Catalog"/> + <features value="Bundle"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product sku"/> + <description value="Guest customer should be able to advance search Bundle product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-143"/> + <group value="Bundle"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiBundleProduct" stepKey="product"/> <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </getData> <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple1"/> </createData> <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple2"/> </createData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> + </after> </test> - <test name="AdvanceCatalogSearchBundleByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchBundleByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> <annotations> - <group value="Catalog"/> + <features value="Bundle"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product description"/> + <description value="Guest customer should be able to advance search Bundle product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-242"/> + <group value="Bundle"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiBundleProduct" stepKey="product"/> <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </getData> <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple1"/> </createData> <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple2"/> </createData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> + </after> </test> - <test name="AdvanceCatalogSearchBundleByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchBundleByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> <annotations> - <group value="Catalog"/> + <features value="Bundle"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product short description"/> + <description value="Guest customer should be able to advance search Bundle product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-250"/> + <group value="Bundle"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiBundleProduct" stepKey="product"/> <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </getData> <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple1"/> </createData> <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple2"/> </createData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> + </after> </test> - <test name="AdvanceCatalogSearchBundleByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchBundleByPriceTest" extends="AdvanceCatalogSearchSimpleProductByPriceTest"> <annotations> - <group value="Catalog"/> + <features value="Bundle"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Bundle product with product price"/> + <description value="Guest customer should be able to advance search Bundle product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-251"/> + <group value="Bundle"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiBundleProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiBundleProduct" stepKey="product"/> <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </getData> <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple1"/> </createData> <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="getBundleOption"/> <requiredEntity createDataKey="simple2"/> </createData> + <getData entity="GetProduct" stepKey="arg1"> + <requiredEntity createDataKey="product"/> + </getData> + <getData entity="GetProduct" stepKey="arg2"> + <requiredEntity createDataKey="simple1"/> + </getData> + <getData entity="GetProduct" stepKey="arg3"> + <requiredEntity createDataKey="simple2"/> + </getData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> + <after> + <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> + </after> </test> </tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml index 34110d0417661..17d0c6c2ed340 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml @@ -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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml index 716737883c2eb..b04b4bb98c854 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml @@ -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"> @@ -115,7 +118,10 @@ </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 --> @@ -148,4 +154,7 @@ <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> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchSimpleProductTest.xml index aed0de5800153..a302fa58ec241 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchSimpleProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchSimpleProductTest.xml @@ -10,13 +10,96 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search simple product with product name"/> + <description value="Guest customer should be able to advance search simple product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-132"/> <group value="Catalog"/> </annotations> <before> - <createData entity="ApiProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="product"/> </before> <after> - <deleteData createDataKey="createProductOne" stepKey="deleteProductOne"/> + <deleteData createDataKey="product" stepKey="delete"/> + </after> + </test> + <test name="AdvanceCatalogSearchSimpleProductBySkuTest"> + <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search simple product with product sku"/> + <description value="Guest customer should be able to advance search simple product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-133"/> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="product"/> + </before> + <after> + <deleteData createDataKey="product" stepKey="delete"/> + </after> + </test> + <test name="AdvanceCatalogSearchSimpleProductByDescriptionTest"> + <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search simple product with product description"/> + <description value="Guest customer should be able to advance search simple product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-134"/> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="product"/> + </before> + <after> + <deleteData createDataKey="product" stepKey="delete"/> + </after> + </test> + <test name="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> + <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search simple product with product short description"/> + <description value="Guest customer should be able to advance search simple product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-135"/> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="product"/> + </before> + <after> + <deleteData createDataKey="product" stepKey="delete"/> + </after> + </test> + <test name="AdvanceCatalogSearchSimpleProductByPriceTest"> + <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search simple product with product price"/> + <description value="Guest customer should be able to advance search simple product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-136"/> + <group value="Catalog"/> + </annotations> + <before> + <createData entity="ApiProductWithDescription" stepKey="product"/> + <getData entity="GetProduct" stepKey="arg1"> + <requiredEntity createDataKey="product"/> + </getData> + <getData entity="GetProduct" stepKey="arg2"> + <requiredEntity createDataKey="product"/> + </getData> + <getData entity="GetProduct" stepKey="arg3"> + <requiredEntity createDataKey="product"/> + </getData> + </before> + <after> + <deleteData createDataKey="product" stepKey="delete"/> </after> </test> </tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml index 775754143bc7e..0eb8f5668751a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml @@ -10,42 +10,72 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdvanceCatalogSearchVirtualProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product name"/> + <description value="Guest customer should be able to advance search virtual product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-137"/> <group value="Catalog"/> </annotations> <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> </before> </test> - <test name="AdvanceCatalogSearchVirtualProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchVirtualProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product sku"/> + <description value="Guest customer should be able to advance search virtual product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-162"/> <group value="Catalog"/> </annotations> <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> </before> </test> - <test name="AdvanceCatalogSearchVirtualProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchVirtualProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product description"/> + <description value="Guest customer should be able to advance search virtual product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-163"/> <group value="Catalog"/> </annotations> <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> </before> </test> - <test name="AdvanceCatalogSearchVirtualProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchVirtualProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product short description"/> + <description value="Guest customer should be able to advance search virtual product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-164"/> <group value="Catalog"/> </annotations> <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> </before> </test> - <test name="AdvanceCatalogSearchVirtualProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchVirtualProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByPriceTest"> <annotations> + <features value="Catalog"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search virtual product with product price"/> + <description value="Guest customer should be able to advance search virtual product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-165"/> <group value="Catalog"/> </annotations> <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> </before> </test> </tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchBundleProductTest.xml deleted file mode 100644 index a94918313c206..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchBundleProductTest.xml +++ /dev/null @@ -1,80 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchBundleByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product name"/> - <description value="Guest customer should be able to advance search Bundle product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-139"/> - <group value="CatalogSearch"/> - </annotations> - </test> - <test name="AdvanceCatalogSearchBundleBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product sku"/> - <description value="Guest customer should be able to advance search Bundle product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-143"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> - <argument name="sku" value="$$createProductOne.sku$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchBundleByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product description"/> - <description value="Guest customer should be able to advance search Bundle product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-242"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> - <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchBundleByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product short description"/> - <description value="Guest customer should be able to advance search Bundle product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-250"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> - <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchBundleByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product price"/> - <description value="Guest customer should be able to advance search Bundle product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-251"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> - <argument name="name" value="$$createProductOne.name$$"/> - <argument name="priceFrom" value="$$simple1.price$$"/> - <argument name="priceTo" value="$$simple1.price$$"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchConfigurableTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchConfigurableTest.xml deleted file mode 100644 index 88b3ed0f9419d..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchConfigurableTest.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchConfigurableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search configurable product with product name"/> - <description value="Guest customer should be able to advance search configurable product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-138"/> - <group value="CatalogSearch"/> - </annotations> - </test> - <test name="AdvanceCatalogSearchConfigurableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search configurable product with product sku"/> - <description value="Guest customer should be able to advance search configurable product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-144"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> - <argument name="sku" value="$$createProductOne.sku$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchConfigurableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search configurable product with product description"/> - <description value="Guest customer should be able to advance search configurable product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-237"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> - <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchConfigurableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search configurable product with product short description"/> - <description value="Guest customer should be able to advance search configurable product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-240"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> - <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchDownloadableProductTest.xml deleted file mode 100644 index bfb96dd23f06b..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchDownloadableProductTest.xml +++ /dev/null @@ -1,80 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchDownloadableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product name"/> - <description value="Guest customer should be able to advance search Downloadable product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-142"/> - <group value="CatalogSearch"/> - </annotations> - </test> - <test name="AdvanceCatalogSearchDownloadableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product sku"/> - <description value="Guest customer should be able to advance search Downloadable product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-252"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> - <argument name="sku" value="$$createProductOne.sku$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchDownloadableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product description"/> - <description value="Guest customer should be able to advance search Downloadable product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-243"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> - <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchDownloadableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product short description"/> - <description value="Guest customer should be able to advance search Downloadable product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-245"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> - <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchDownloadableByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product price"/> - <description value="Guest customer should be able to advance search Downloadable product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-246"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> - <argument name="name" value="$$createProductOne.name$$"/> - <argument name="priceFrom" value="$$createProductOne.price$$"/> - <argument name="priceTo" value="$$createProductOne.price$$"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchGroupedProductTest.xml deleted file mode 100644 index aaba96848cb6c..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchGroupedProductTest.xml +++ /dev/null @@ -1,80 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchGroupedProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product name"/> - <description value="Guest customer should be able to advance search Grouped product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-141"/> - <group value="CatalogSearch"/> - </annotations> - </test> - <test name="AdvanceCatalogSearchGroupedProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product sku"/> - <description value="Guest customer should be able to advance search Grouped product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-146"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> - <argument name="sku" value="$$createProductOne.sku$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchGroupedProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product description"/> - <description value="Guest customer should be able to advance search Grouped product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-282"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> - <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchGroupedProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product short description"/> - <description value="Guest customer should be able to advance search Grouped product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-283"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> - <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchGroupedProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product price"/> - <description value="Guest customer should be able to advance search Grouped product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-284"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> - <argument name="name" value="$$createProductOne.name$$"/> - <argument name="priceFrom" value="$$simple1.price$$"/> - <argument name="priceTo" value="$$simple1.price$$"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductTest.xml index dbe225c24debc..11bc308902ca0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchSimpleProductTest.xml @@ -11,77 +11,68 @@ <test name="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search simple product with product name"/> - <description value="Guest customer should be able to advance search simple product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-132"/> <group value="CatalogSearch"/> </annotations> <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameActionGroup" stepKey="search"> - <argument name="name" value="$$createProductOne.name$$"/> + <argument name="name" value="$$product.name$$"/> </actionGroup> <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> - <see userInput="$$createProductOne.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> + <see userInput="$$product.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> - <test name="AdvanceCatalogSearchSimpleProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchSimpleProductBySkuTest"> <annotations> <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search simple product with product sku"/> - <description value="Guest customer should be able to advance search simple product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-133"/> <group value="CatalogSearch"/> </annotations> + <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> - <argument name="sku" value="$$createProductOne.sku$$"/> + <argument name="sku" value="$$product.sku$$"/> </actionGroup> + <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> + <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> + <see userInput="$$product.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> - <test name="AdvanceCatalogSearchSimpleProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchSimpleProductByDescriptionTest"> <annotations> <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search simple product with product description"/> - <description value="Guest customer should be able to advance search simple product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-134"/> <group value="CatalogSearch"/> </annotations> + <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> - <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> + <argument name="description" value="$$product.custom_attributes[description]$$"/> </actionGroup> + <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> + <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> + <see userInput="$$product.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> - <test name="AdvanceCatalogSearchSimpleProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> <annotations> <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search simple product with product short description"/> - <description value="Guest customer should be able to advance search simple product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-135"/> <group value="CatalogSearch"/> </annotations> + <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> - <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> + <argument name="shortDescription" value="$$product.custom_attributes[short_description]$$"/> </actionGroup> + <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> + <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> + <see userInput="$$product.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> - <test name="AdvanceCatalogSearchSimpleProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchSimpleProductByPriceTest"> <annotations> <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search simple product with product price"/> - <description value="Guest customer should be able to advance search simple product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-136"/> <group value="CatalogSearch"/> </annotations> + <actionGroup ref="GoToStoreViewAdvancedCatalogSearchActionGroup" stepKey="GoToStoreViewAdvancedCatalogSearchActionGroup"/> <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> - <argument name="name" value="$$createProductOne.name$$"/> - <argument name="priceFrom" value="$$createProductOne.price$$"/> - <argument name="priceTo" value="$$createProductOne.price$$"/> + <argument name="name" value="$$arg1.name$$"/> + <argument name="priceFrom" value="$$arg2.price$$"/> + <argument name="priceTo" value="$$arg3.price$$"/> </actionGroup> + <actionGroup ref="StorefrontCheckAdvancedSearchResultActionGroup" stepKey="StorefrontCheckAdvancedSearchResult"/> + <see userInput="1 item" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.itemFound}}" stepKey="see"/> + <see userInput="$$arg1.name$$" selector="{{StorefrontCatalogSearchAdvancedResultMainSection.productName}}" stepKey="seeProductName"/> </test> </tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductTest.xml deleted file mode 100644 index 98bc7f01a6a00..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogSearch/Test/AdvanceCatalogSearchVirtualProductTest.xml +++ /dev/null @@ -1,80 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchVirtualProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product name"/> - <description value="Guest customer should be able to advance search virtual product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-137"/> - <group value="CatalogSearch"/> - </annotations> - </test> - <test name="AdvanceCatalogSearchVirtualProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product sku"/> - <description value="Guest customer should be able to advance search virtual product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-162"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductSkuActionGroup" stepKey="search"> - <argument name="sku" value="$$createProductOne.sku$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchVirtualProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product description"/> - <description value="Guest customer should be able to advance search virtual product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-163"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByDescriptionActionGroup" stepKey="search"> - <argument name="description" value="$$createProductOne.custom_attributes[description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchVirtualProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product short description"/> - <description value="Guest customer should be able to advance search virtual product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-164"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByShortDescriptionActionGroup" stepKey="search"> - <argument name="shortDescription" value="$$createProductOne.custom_attributes[short_description]$$"/> - </actionGroup> - </test> - <test name="AdvanceCatalogSearchVirtualProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="CatalogSearch"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product price"/> - <description value="Guest customer should be able to advance search virtual product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-165"/> - <group value="CatalogSearch"/> - </annotations> - <actionGroup ref="StorefrontAdvancedCatalogSearchByProductNameAndPriceActionGroup" stepKey="search"> - <argument name="name" value="$$createProductOne.name$$"/> - <argument name="priceFrom" value="$$createProductOne.price$$"/> - <argument name="priceTo" value="$$createProductOne.price$$"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml index 65760b5e72308..454f9f5f29a7a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml @@ -10,7 +10,13 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdvanceCatalogSearchConfigurableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> - <group value="Catalog"/> + <features value="ConfigurableProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search configurable product with product name"/> + <description value="Guest customer should be able to advance search configurable product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-138"/> + <group value="ConfigurableProduct"/> </annotations> <before> <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> @@ -19,12 +25,12 @@ <requiredEntity createDataKey="categoryHandle"/> </createData> - <createData entity="SimpleProduct" stepKey="simple2Handle" before="createProductOne"> + <createData entity="SimpleProduct" stepKey="simple2Handle" before="product"> <requiredEntity createDataKey="categoryHandle"/> </createData> <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> - <createData entity="ApiConfigurableProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiConfigurableProductWithDescription" stepKey="product"/> <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> @@ -56,25 +62,35 @@ </createData> <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="productAttributeHandle"/> <requiredEntity createDataKey="getAttributeOption1Handle"/> <requiredEntity createDataKey="getAttributeOption2Handle"/> </createData> <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="childProductHandle1"/> </createData> <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="childProductHandle2"/> </createData> </before> + <after> + <deleteData createDataKey="simple1Handle" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2Handle" stepKey="deleteSimple2" before="delete"/> + </after> </test> - <test name="AdvanceCatalogSearchConfigurableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchConfigurableBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> <annotations> - <group value="Catalog"/> + <features value="ConfigurableProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search configurable product with product sku"/> + <description value="Guest customer should be able to advance search configurable product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-144"/> + <group value="ConfigurableProduct"/> </annotations> <before> <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> @@ -83,12 +99,12 @@ <requiredEntity createDataKey="categoryHandle"/> </createData> - <createData entity="SimpleProduct" stepKey="simple2Handle" before="createProductOne"> + <createData entity="SimpleProduct" stepKey="simple2Handle" before="product"> <requiredEntity createDataKey="categoryHandle"/> </createData> <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> - <createData entity="ApiConfigurableProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiConfigurableProductWithDescription" stepKey="product"/> <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> @@ -120,25 +136,35 @@ </createData> <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="productAttributeHandle"/> <requiredEntity createDataKey="getAttributeOption1Handle"/> <requiredEntity createDataKey="getAttributeOption2Handle"/> </createData> <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="childProductHandle1"/> </createData> <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="childProductHandle2"/> </createData> </before> + <after> + <deleteData createDataKey="simple1Handle" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2Handle" stepKey="deleteSimple2" before="delete"/> + </after> </test> - <test name="AdvanceCatalogSearchConfigurableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchConfigurableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> <annotations> - <group value="Catalog"/> + <features value="ConfigurableProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search configurable product with product description"/> + <description value="Guest customer should be able to advance search configurable product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-237"/> + <group value="ConfigurableProduct"/> </annotations> <before> <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> @@ -147,12 +173,12 @@ <requiredEntity createDataKey="categoryHandle"/> </createData> - <createData entity="SimpleProduct" stepKey="simple2Handle" before="createProductOne"> + <createData entity="SimpleProduct" stepKey="simple2Handle" before="product"> <requiredEntity createDataKey="categoryHandle"/> </createData> <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> - <createData entity="ApiConfigurableProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiConfigurableProductWithDescription" stepKey="product"/> <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> @@ -184,25 +210,35 @@ </createData> <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="productAttributeHandle"/> <requiredEntity createDataKey="getAttributeOption1Handle"/> <requiredEntity createDataKey="getAttributeOption2Handle"/> </createData> <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="childProductHandle1"/> </createData> <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="childProductHandle2"/> </createData> </before> + <after> + <deleteData createDataKey="simple1Handle" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2Handle" stepKey="deleteSimple2" before="delete"/> + </after> </test> - <test name="AdvanceCatalogSearchConfigurableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchConfigurableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> <annotations> - <group value="Catalog"/> + <features value="ConfigurableProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search configurable product with product short description"/> + <description value="Guest customer should be able to advance search configurable product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-240"/> + <group value="ConfigurableProduct"/> </annotations> <before> <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> @@ -211,12 +247,12 @@ <requiredEntity createDataKey="categoryHandle"/> </createData> - <createData entity="SimpleProduct" stepKey="simple2Handle" before="createProductOne"> + <createData entity="SimpleProduct" stepKey="simple2Handle" before="product"> <requiredEntity createDataKey="categoryHandle"/> </createData> <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> - <createData entity="ApiConfigurableProductWithDescription" stepKey="createProductOne"/> + <createData entity="ApiConfigurableProductWithDescription" stepKey="product"/> <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> @@ -248,20 +284,24 @@ </createData> <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="productAttributeHandle"/> <requiredEntity createDataKey="getAttributeOption1Handle"/> <requiredEntity createDataKey="getAttributeOption2Handle"/> </createData> <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="childProductHandle1"/> </createData> <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="childProductHandle2"/> </createData> </before> + <after> + <deleteData createDataKey="simple1Handle" stepKey="deleteSimple1" before="deleteSimple2"/> + <deleteData createDataKey="simple2Handle" stepKey="deleteSimple2" before="delete"/> + </after> </test> </tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml index 34c8b0a815477..af5d20b075d12 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml @@ -10,71 +10,101 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdvanceCatalogSearchDownloadableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> - <group value="Catalog"/> + <features value="Downloadable"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product name"/> + <description value="Guest customer should be able to advance search Downloadable product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-142"/> + <group value="Downloadable"/> </annotations> <before> - <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <createData entity="ApiDownloadableProduct" stepKey="product"/> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> </before> </test> - <test name="AdvanceCatalogSearchDownloadableBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchDownloadableBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> <annotations> - <group value="Catalog"/> + <features value="Downloadable"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product sku"/> + <description value="Guest customer should be able to advance search Downloadable product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-252"/> + <group value="Downloadable"/> </annotations> <before> - <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <createData entity="ApiDownloadableProduct" stepKey="product"/> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> </before> </test> - <test name="AdvanceCatalogSearchDownloadableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchDownloadableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> <annotations> - <group value="Catalog"/> + <features value="Downloadable"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product description"/> + <description value="Guest customer should be able to advance search Downloadable product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-243"/> + <group value="Downloadable"/> </annotations> <before> - <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <createData entity="ApiDownloadableProduct" stepKey="product"/> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> </before> </test> - <test name="AdvanceCatalogSearchDownloadableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchDownloadableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> <annotations> - <group value="Catalog"/> + <features value="Downloadable"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product short description"/> + <description value="Guest customer should be able to advance search Downloadable product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-245"/> + <group value="Downloadable"/> </annotations> <before> - <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <createData entity="ApiDownloadableProduct" stepKey="product"/> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> </before> </test> - <test name="AdvanceCatalogSearchDownloadableByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchDownloadableByPriceTest" extends="AdvanceCatalogSearchSimpleProductByPriceTest"> <annotations> - <group value="Catalog"/> + <features value="Downloadable"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Downloadable product with product price"/> + <description value="Guest customer should be able to advance search Downloadable product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-246"/> + <group value="Downloadable"/> </annotations> <before> - <createData entity="ApiDownloadableProduct" stepKey="createProductOne"/> + <createData entity="ApiDownloadableProduct" stepKey="product"/> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> </createData> </before> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml index 9b11a76d16cd4..0fd52ac4a65a4 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml @@ -10,18 +10,24 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="AdvanceCatalogSearchGroupedProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> <annotations> - <group value="Catalog"/> + <features value="GroupedProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product name"/> + <description value="Guest customer should be able to advance search Grouped product with product name"/> + <severity value="MAJOR"/> + <testCaseId value="MC-141"/> + <group value="GroupedProduct"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiGroupedProduct" stepKey="product"/> <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple1"/> </createData> <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> @@ -29,23 +35,29 @@ </before> <after> <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> </after> </test> - <test name="AdvanceCatalogSearchGroupedProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchGroupedProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> <annotations> - <group value="Catalog"/> + <features value="GroupedProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product sku"/> + <description value="Guest customer should be able to advance search Grouped product with product sku"/> + <severity value="MAJOR"/> + <testCaseId value="MC-146"/> + <group value="GroupedProduct"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiGroupedProduct" stepKey="product"/> <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple1"/> </createData> <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> @@ -53,23 +65,29 @@ </before> <after> <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> </after> </test> - <test name="AdvanceCatalogSearchGroupedProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchGroupedProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> <annotations> - <group value="Catalog"/> + <features value="GroupedProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product description"/> + <description value="Guest customer should be able to advance search Grouped product with product description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-282"/> + <group value="GroupedProduct"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiGroupedProduct" stepKey="product"/> <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple1"/> </createData> <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> @@ -77,23 +95,29 @@ </before> <after> <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> </after> </test> - <test name="AdvanceCatalogSearchGroupedProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchGroupedProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> <annotations> - <group value="Catalog"/> + <features value="GroupedProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product short description"/> + <description value="Guest customer should be able to advance search Grouped product with product short description"/> + <severity value="MAJOR"/> + <testCaseId value="MC-283"/> + <group value="GroupedProduct"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiGroupedProduct" stepKey="product"/> <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple1"/> </createData> <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> @@ -101,31 +125,46 @@ </before> <after> <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> </after> </test> - <test name="AdvanceCatalogSearchGroupedProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> + <test name="AdvanceCatalogSearchGroupedProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByPriceTest"> <annotations> - <group value="Catalog"/> + <features value="GroupedProduct"/> + <stories value="Advanced Catalog Product Search for all product types"/> + <title value="Guest customer should be able to advance search Grouped product with product price"/> + <description value="Guest customer should be able to advance search Grouped product with product price"/> + <severity value="MAJOR"/> + <testCaseId value="MC-284"/> + <group value="GroupedProduct"/> </annotations> <before> <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="createProductOne"/> - <createData entity="ApiGroupedProduct" stepKey="createProductOne"/> + <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> + <createData entity="ApiGroupedProduct" stepKey="product"/> <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple1"/> </createData> <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="createProductOne"/> + <requiredEntity createDataKey="product"/> <requiredEntity createDataKey="simple2"/> </updateData> + <getData entity="GetProduct3" stepKey="arg1"> + <requiredEntity createDataKey="product"/> + </getData> + <getData entity="GetProduct" stepKey="arg2"> + <requiredEntity createDataKey="simple1"/> + </getData> + <getData entity="GetProduct" stepKey="arg3"> + <requiredEntity createDataKey="simple2"/> + </getData> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="deleteProductOne"/> + <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> </after> </test> </tests> From 776988b3e56127947b52c8e23923d2b13447d53b Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Wed, 6 Jun 2018 15:06:59 -0500 Subject: [PATCH 069/133] MC-179: Admin should be able to update existing attributes of a configurable product - Parameterized selectors and reduced redundancy --- .../AdminProductGridActionGroup.xml | 17 -------------- .../AdminProductAttributeSetSection.xml | 8 ++++--- .../StorefrontProductInfoMainSection.xml | 3 ++- ...ConfigurableProductUpdateAttributeTest.xml | 23 +++++++++++-------- 4 files changed, 21 insertions(+), 30 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml index f995e2abed8df..6398010f06687 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductGridActionGroup.xml @@ -132,23 +132,6 @@ <click selector="{{AdminProductGridFilterSection.clearFilters}}" stepKey="clickClearFiltersAfter"/> </actionGroup> - <!-- Find a product by filtering grid and clicking on it --> - <actionGroup name="findProductUsingProductGrid"> - <arguments> - <argument name="product"/> - </arguments> - <!--TODO use other action group for filtering grid when MQE-539 is implemented --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/> - <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad" /> - </actionGroup> - <!--Delete a product by filtering grid and using delete action--> <actionGroup name="deleteProductUsingProductGrid"> <arguments> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml index 1892862593c60..049214bae35b3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml @@ -17,8 +17,10 @@ <section name="Group"> <element name="FolderName" type="text" selector="//span[text()='{{var1}}']" parameterized="true"/> </section> - <section name="modifyAttributes"> - <element name="firstExistingAttribute" type="block" selector=".admin__field:nth-of-type(1) .admin__control-select"/> - <element name="secondAttributeOption" type="block" selector=".admin__field:nth-of-type(1) .admin__control-select option:nth-of-type(2)"/> + <section name="ModifyAttributes"> + <!-- Parameter is the order number of the attribute on the page (1 is the newest) --> + <element name="nthExistingAttribute" type="block" selector=".admin__field:nth-of-type({{numElement}}) .admin__control-select" parameterized="true"/> + <!-- First parameter is the order number of the attribute on the page, 2nd parameter is the number option in the dropdown (1 for blank) --> + <element name="nthAttributeOption" type="block" selector=".admin__field:nth-of-type({{numElement}}) .admin__control-select option:nth-of-type({{numOption}})" parameterized="true"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml index 67ba5362bc198..33ecb0ce77692 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml @@ -14,6 +14,7 @@ <element name="productAttributeOptions1" type="select" selector="#product-options-wrapper div[tabindex='0'] option"/> <element name="productAttributeOptionsSelectButton" type="select" selector="#product-options-wrapper .super-attribute-select"/> <element name="productAttributeOptionsError" type="text" selector="//div[@class='mage-error']"/> - <element name="firstAttributeOnPage" type="block" selector="tr:nth-of-type(1) .data"/> + <!-- Parameter is the order number of the attribute on the page (1 is the newest) --> + <element name="nthAttributeOnPage" type="block" selector="tr:nth-of-type({{numElement}}) .data" parameterized="true"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml index 6abc4866bac8e..49774539cda7c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -11,11 +11,11 @@ <test name="AdminConfigurableProductUpdateAttributeTest"> <annotations> <features value="ConfigurableProduct"/> - <stories value="Update Attribute"/> + <stories value="Edit a configurable product in admin"/> <title value="Admin should be able to update existing attributes of a configurable product"/> <description value="Admin should be able to update existing attributes of a configurable product"/> <severity value="AVERAGE"/> - <testCaseId value="MC-84"/> + <testCaseId value="MC-179"/> <group value="ConfigurableProduct"/> </annotations> @@ -92,17 +92,22 @@ <!-- Get the current option of the attribute before it was changed --> <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad" /> - <grabTextFrom stepKey="getBeforeOption" selector="{{StorefrontProductInfoMainSection.firstAttributeOnPage}}" /> + <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad" /> + <grabTextFrom stepKey="getBeforeOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}" /> <!-- Find the product that we just created using the product grid --> - <actionGroup ref="findProductUsingProductGrid" stepKey="goToCreatedProduct"> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> <argument name="product" value="ApiConfigurableProduct" /> </actionGroup> + <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad" /> + <!-- change the option on the first attribute --> - <click stepKey="clickFirstAttribute" selector="{{modifyAttributes.firstExistingAttribute}}" /> - <click stepKey="clickSecondAttributeOption" selector="{{modifyAttributes.secondAttributeOption}}" /> + <click stepKey="clickFirstAttribute" selector="{{ModifyAttributes.nthExistingAttribute('1')}}" /> + <click stepKey="clickSecondAttributeOption" selector="{{ModifyAttributes.nthAttributeOption('1', '2')}}" /> <!-- Save the product --> <click stepKey="saveProductAttribute" selector="{{AdminProductFormActionSection.saveButton}}" /> @@ -111,8 +116,8 @@ <!-- Go back to the configurable product page and check to see if it has changed --> <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage2"/> - <waitForPageLoad stepKey="waitForProductPageLoad2" /> - <grabTextFrom stepKey="getCurrentOption" selector="{{StorefrontProductInfoMainSection.firstAttributeOnPage}}" /> + <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad2" /> + <grabTextFrom stepKey="getCurrentOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}" /> <assertNotEquals expected="{$getBeforeOption}" expectedType="string" actual="{$getCurrentOption}" actualType="string" stepKey="assertNotEquals"/> </test> From 21ce9fb9ae8696d24343058a981aaa18b8bc16d8 Mon Sep 17 00:00:00 2001 From: hitesh-wagento <hitesh@wagento.com> Date: Thu, 7 Jun 2018 10:07:46 +0530 Subject: [PATCH 070/133] --- .../Magento/blank/web/css/source/_sections.less | 4 +--- .../Magento/blank/web/css/source/_variables.less | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/design/frontend/Magento/blank/web/css/source/_sections.less b/app/design/frontend/Magento/blank/web/css/source/_sections.less index d5d6e5a3d105c..f0a3518c92a8b 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_sections.less +++ b/app/design/frontend/Magento/blank/web/css/source/_sections.less @@ -20,9 +20,7 @@ .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .product.data.items { - .lib-data-tabs( - @_tab-content-border-top-status: true - ); + .lib-data-tabs(); } } diff --git a/app/design/frontend/Magento/blank/web/css/source/_variables.less b/app/design/frontend/Magento/blank/web/css/source/_variables.less index 5d946dd8a826e..256bc796dba94 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_variables.less +++ b/app/design/frontend/Magento/blank/web/css/source/_variables.less @@ -15,6 +15,16 @@ @font-family-name__base: 'Open Sans'; @font-family__base: @font-family-name__base, @font-family__sans-serif; +// +// Sections variables +// _____________________________________________ + +// +// Tabs +// --------------------------------------------- +@tab-content__border-top-status: true; + + // // Sidebar // --------------------------------------------- From a0186de28e24b40b771ef56ee46ae4414434ecee Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@transoftgroup.com> Date: Thu, 7 Jun 2018 11:04:41 +0300 Subject: [PATCH 071/133] MAGETWO-92137: Refreshing page deletes shipping address on guest checkout if module-persistent is enabled --- ...CheckExpirePersistentQuoteObserverTest.php | 21 ++--- .../NavigateToCheckoutActionGroup.xml | 16 ---- .../GuestCheckoutReviewAndPaymentsPage.xml | 2 +- .../CheckoutShippingGuestInfoSection.xml | 2 + .../Section/GuestCheckoutPaymentSection.xml | 18 ----- .../Section/GuestCheckoutShippingSection.xml | 23 ------ .../Checkout/Section/PaymentMethodSection.xml | 14 ---- .../Checkout/Section/ShipToSection.xml | 14 ---- ...GuestCheckoutWithEnabledPersistentTest.xml | 80 +++++++++---------- 9 files changed, 53 insertions(+), 137 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/NavigateToCheckoutActionGroup.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutPaymentSection.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutShippingSection.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/PaymentMethodSection.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/ShipToSection.xml diff --git a/app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php b/app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php index 366034c8a3e4f..8cad0b9f2dd89 100644 --- a/app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php @@ -91,7 +91,7 @@ public function testExecuteWhenCanNotApplyPersistentData() ->expects($this->once()) ->method('canProcess') ->with($this->observerMock) - ->will($this->returnValue(false)); + ->willReturn(false); $this->persistentHelperMock->expects($this->never())->method('isEnabled'); $this->model->execute($this->observerMock); } @@ -102,8 +102,8 @@ public function testExecuteWhenPersistentIsNotEnabled() ->expects($this->once()) ->method('canProcess') ->with($this->observerMock) - ->will($this->returnValue(true)); - $this->persistentHelperMock->expects($this->once())->method('isEnabled')->will($this->returnValue(false)); + ->willReturn(true); + $this->persistentHelperMock->expects($this->once())->method('isEnabled')->willReturn(false); $this->eventManagerMock->expects($this->never())->method('dispatch'); $this->model->execute($this->observerMock); } @@ -116,6 +116,7 @@ public function testExecuteWhenPersistentIsNotEnabled() * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expireCounter * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $dispatchCounter * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $setCustomerIdCounter + * @return void * @dataProvider requestDataProvider */ public function testExecuteWhenPersistentIsEnabled( @@ -124,29 +125,29 @@ public function testExecuteWhenPersistentIsEnabled( \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expireCounter, \PHPUnit_Framework_MockObject_Matcher_InvokedCount $dispatchCounter, \PHPUnit_Framework_MockObject_Matcher_InvokedCount $setCustomerIdCounter - ) { + ): void { $this->persistentHelperMock ->expects($this->once()) ->method('canProcess') ->with($this->observerMock) - ->will($this->returnValue(true)); - $this->persistentHelperMock->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); - $this->sessionMock->expects($this->once())->method('isPersistent')->will($this->returnValue(false)); + ->willReturn(true); + $this->persistentHelperMock->expects($this->once())->method('isEnabled')->willReturn(true); + $this->sessionMock->expects($this->once())->method('isPersistent')->willReturn(false); $this->customerSessionMock ->expects($this->atLeastOnce()) ->method('isLoggedIn') - ->will($this->returnValue(false)); + ->willReturn(false); $this->checkoutSessionMock ->expects($this->atLeastOnce()) ->method('getQuoteId') - ->will($this->returnValue(10)); + ->willReturn(10); $this->eventManagerMock->expects($dispatchCounter)->method('dispatch'); $this->quoteManagerMock->expects($expireCounter)->method('expire'); $this->customerSessionMock ->expects($setCustomerIdCounter) ->method('setCustomerId') ->with(null) - ->will($this->returnSelf()); + ->willReturnSelf(); $this->requestMock->expects($this->atLeastOnce())->method('getRequestUri')->willReturn($refererUri); $this->requestMock ->expects($this->atLeastOnce()) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/NavigateToCheckoutActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/NavigateToCheckoutActionGroup.xml deleted file mode 100644 index 94c70e9846814..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/ActionGroup/NavigateToCheckoutActionGroup.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?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="NavigateToCheckoutActionGroup"> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> - <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> - <!--<waitForPageLoad stepKey="waitForPageLoad2"/>--> - </actionGroup> -</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml index 15124da1f35da..3e8411629dd6f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml @@ -7,7 +7,7 @@ --> <pages 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="GuestCheckoutPage" url="/checkout/#payment" area="storefront" module="Checkout"> + <page name="GuestCheckoutReviewAndPaymentsPage" url="/checkout/#payment" area="storefront" module="Magento_Checkout"> <section name="PaymentMethodSection"/> <section name="ShipToSection"/> </page> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingGuestInfoSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingGuestInfoSection.xml index f20ae4dac07d5..f2cca89be6c18 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingGuestInfoSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutShippingGuestInfoSection.xml @@ -17,5 +17,7 @@ <element name="region" type="select" selector="select[name=region_id]"/> <element name="postcode" type="input" selector="input[name=postcode]"/> <element name="telephone" type="input" selector="input[name=telephone]"/> + <element name="next" type="button" selector="button.button.action.continue.primary" timeout="30"/> + <element name="firstShippingMethod" type="radio" selector=".row:nth-of-type(1) .col-method .radio"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutPaymentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutPaymentSection.xml deleted file mode 100644 index ef633e5470958..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutPaymentSection.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections 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="GuestCheckoutPaymentSection"> - <!--<element name="cartItemsArea" type="textarea" selector=".items-in-cart"/>--> - <!--<element name="cartItemsAreaActive" type="textarea" selector="div.block.items-in-cart.active"/>--> - <!--<element name="cartItems" type="text" selector=".minicart-items"/>--> - <!--<element name="billingAddress" type="text" selector="div.billing-address-details"/>--> - <element name="placeOrder" type="button" selector="button.action.primary.checkout" timeout="30"/> - </section> -</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutShippingSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutShippingSection.xml deleted file mode 100644 index 0af05846f4b54..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/GuestCheckoutShippingSection.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections 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="GuestCheckoutShippingSection"> - <element name="email" type="input" selector="#customer-email"/> - <element name="firstName" type="input" selector="input[name=firstname]"/> - <element name="lastName" type="input" selector="input[name=lastname]"/> - <element name="street" type="input" selector="input[name='street[0]']"/> - <element name="city" type="input" selector="input[name=city]"/> - <element name="region" type="select" selector="select[name=region_id]"/> - <element name="postcode" type="input" selector="input[name=postcode]"/> - <element name="telephone" type="input" selector="input[name=telephone]"/> - <element name="next" type="button" selector="button.button.action.continue.primary"/> - <element name="firstShippingMethod" type="radio" selector=".row:nth-of-type(1) .col-method .radio"/> - </section> -</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/PaymentMethodSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/PaymentMethodSection.xml deleted file mode 100644 index a12302f4436bd..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/PaymentMethodSection.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections 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="PaymentMethodSection"> - <element name="billingAddress" type="text" selector=".checkout-billing-address"/> - </section> -</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/ShipToSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/ShipToSection.xml deleted file mode 100644 index 344c39d0c35ec..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/ShipToSection.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections 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="ShipToSection"> - <element name="shippingInformation" type="text" selector=".shipping-information-content"/> - </section> -</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml index fa50738bf5819..f1499d14e1fc6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml @@ -26,60 +26,58 @@ </before> <after> <createData entity="PersistentConfigDefault" stepKey="setDefaultPersistentState"/> - <actionGroup ref="logout" stepKey="adminLogout"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> </after> <!-- Add simple product to cart --> - <actionGroup stepKey="addProductToCart1" ref="AddSimpleProductToCart"> + <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart1"> <argument name="product" value="$$createProduct$$"/> </actionGroup> <!-- Navigate to checkout --> - <actionGroup stepKey="addProductNavigateToCheckout" ref="NavigateToCheckoutActionGroup"/> + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="navigateToCheckoutFromMinicart"/> <!-- Fill Shipping Address form --> - <fillField selector="{{GuestCheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> - <fillField selector="{{GuestCheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> - <fillField selector="{{GuestCheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> - <fillField selector="{{GuestCheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> - <fillField selector="{{GuestCheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> - <selectOption selector="{{GuestCheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> - <fillField selector="{{GuestCheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> - <fillField selector="{{GuestCheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="enterEmail"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="enterFirstName"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="enterLastName"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="enterStreet"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="enterCity"/> + <selectOption selector="{{CheckoutShippingGuestInfoSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="selectRegion"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="enterPostcode"/> + <fillField selector="{{CheckoutShippingGuestInfoSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="enterTelephone"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> - <click selector="{{GuestCheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> + <click selector="{{CheckoutShippingGuestInfoSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/> <!-- Check that have the same values after page reload --> - <amOnPage url="{{CheckoutPage.url}}" stepKey="amOnCheckoutPage2"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> - <seeInField stepKey="seeEmailtOnCheckout" selector="{{GuestCheckoutShippingSection.email}}" userInput="{{CustomerEntityOne.email}}" /> - <seeInField stepKey="seeFirstnameOnCheckout" selector="{{GuestCheckoutShippingSection.firstName}}" userInput="{{CustomerEntityOne.firstName}}" /> - <seeInField stepKey="seeLastnameOnCheckout" selector="{{GuestCheckoutShippingSection.lastName}}" userInput="{{CustomerEntityOne.lastName}}" /> - <seeInField stepKey="seeStreetOnCheckout" selector="{{GuestCheckoutShippingSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" /> - <seeInField stepKey="seeCityOnCheckout" selector="{{GuestCheckoutShippingSection.city}}" userInput="{{CustomerAddressSimple.city}}" /> - <seeInField stepKey="seeStateOnCheckout" selector="{{GuestCheckoutShippingSection.region}}" userInput="{{CustomerAddressSimple.state}}" /> - <seeInField stepKey="seePostcodeOnCheckout" selector="{{GuestCheckoutShippingSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" /> - <seeInField stepKey="seePhoneOnCheckout" selector="{{GuestCheckoutShippingSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" /> - <waitForElement selector="{{GuestCheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/> + <amOnPage url="{{CheckoutPage.url}}" stepKey="amOnCheckoutShippingInfoPage"/> + <waitForPageLoad stepKey="waitForShippingPageReload"/> + <seeInField selector="{{CheckoutShippingGuestInfoSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeEmailOnCheckout" /> + <seeInField selector="{{CheckoutShippingGuestInfoSection.firstName}}" userInput="{{CustomerEntityOne.firstName}}" stepKey="seeFirstnameOnCheckout" /> + <seeInField selector="{{CheckoutShippingGuestInfoSection.lastName}}" userInput="{{CustomerEntityOne.lastName}}" stepKey="seeLastnameOnCheckout" /> + <seeInField selector="{{CheckoutShippingGuestInfoSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeStreetOnCheckout" /> + <seeInField selector="{{CheckoutShippingGuestInfoSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="seeCityOnCheckout" /> + <seeInField selector="{{CheckoutShippingGuestInfoSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="seeStateOnCheckout" /> + <seeInField selector="{{CheckoutShippingGuestInfoSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="seePostcodeOnCheckout" /> + <seeInField selector="{{CheckoutShippingGuestInfoSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="seePhoneOnCheckout" /> <!-- Click next button to open payment section --> - <click selector="{{GuestCheckoutShippingSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{GuestCheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutShippingGuestInfoSection.next}}" stepKey="clickNext"/> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="guestSelectCheckMoneyOrderPayment" /> <!-- Reload payment section --> - <amOnPage url="{{GuestCheckoutPage.url}}" stepKey="amOnCheckoutShipToPage"/> - <waitForElement selector="{{GuestCheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton2"/> + <amOnPage url="{{GuestCheckoutReviewAndPaymentsPage.url}}" stepKey="amOnCheckoutPaymentsPage"/> + <waitForPageLoad stepKey="waitForPaymentPageReload"/> <!-- Check that address block contains correct information --> - <see stepKey="seeBilllingFirstName" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.firstName}}" /> - <see stepKey="seeBilllingLastName" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.lastName}}" /> - <see stepKey="seeBilllingStreet" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" /> - <see stepKey="seeBilllingCity" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.city}}" /> - <see stepKey="seeBilllingState" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.state}}" /> - <see stepKey="seeBilllingPostcode" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.postcode}}" /> - <see stepKey="seeBilllingTelephone" selector="{{PaymentMethodSection.billingAddress}}" userInput="{{CustomerAddressSimple.telephone}}" /> + <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.firstName}}" stepKey="seeBilllingFirstName" /> + <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.lastName}}" stepKey="seeBilllingLastName" /> + <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeBilllingStreet" /> + <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.city}}" stepKey="seeBilllingCity" /> + <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.state}}" stepKey="seeBilllingState" /> + <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="seeBilllingPostcode" /> + <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="seeBilllingTelephone" /> <!-- Check that "Ship To" block contains correct information --> - <see stepKey="seeShipToFirstName" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.firstName}}" /> - <see stepKey="seeShipToLastName" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.lastName}}" /> - <see stepKey="seeShipToStreet" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.street[0]}}" /> - <see stepKey="seeShipToCity" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.city}}" /> - <see stepKey="seeShipToState" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.state}}" /> - <see stepKey="seeShipToPostcode" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.postcode}}" /> - <see stepKey="seeShipToTelephone" selector="{{ShipToSection.shippingInformation}}" userInput="{{CustomerAddressSimple.telephone}}" /> + <see selector="{{CheckoutPaymentSection.shipToInfomation}}" userInput="{{CustomerAddressSimple.firstName}}" stepKey="seeShipToFirstName" /> + <see selector="{{CheckoutPaymentSection.shipToInfomation}}" userInput="{{CustomerAddressSimple.lastName}}" stepKey="seeShipToLastName" /> + <see selector="{{CheckoutPaymentSection.shipToInfomation}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeShipToStreet" /> + <see selector="{{CheckoutPaymentSection.shipToInfomation}}" userInput="{{CustomerAddressSimple.city}}" stepKey="seeShipToCity" /> + <see selector="{{CheckoutPaymentSection.shipToInfomation}}" userInput="{{CustomerAddressSimple.state}}" stepKey="seeShipToState" /> + <see selector="{{CheckoutPaymentSection.shipToInfomation}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="seeShipToPostcode" /> + <see selector="{{CheckoutPaymentSection.shipToInfomation}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="seeShipToTelephone" /> </test> </tests> From f3234e1f59a282e26034a03f5d85cb24ba54bcd8 Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Thu, 7 Jun 2018 12:16:44 +0300 Subject: [PATCH 072/133] MAGETWO-90761: [2.3.0] PayPal orders status display always as Processing --- app/code/Magento/Paypal/Model/Ipn.php | 161 +++++++----------- .../RegisterCaptureNotificationCommand.php | 2 +- ...RegisterCaptureNotificationCommandTest.php | 41 +++-- 3 files changed, 96 insertions(+), 108 deletions(-) diff --git a/app/code/Magento/Paypal/Model/Ipn.php b/app/code/Magento/Paypal/Model/Ipn.php index a370bbc77ffb2..9107762c54b69 100644 --- a/app/code/Magento/Paypal/Model/Ipn.php +++ b/app/code/Magento/Paypal/Model/Ipn.php @@ -7,9 +7,9 @@ namespace Magento\Paypal\Model; use Exception; +use Magento\Framework\Exception\LocalizedException; use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender; use Magento\Sales\Model\Order\Email\Sender\OrderSender; -use Magento\Paypal\Model\Info; /** * PayPal Instant Payment Notification processor model @@ -164,11 +164,11 @@ protected function _processOrder() case Info::TXN_TYPE_NEW_CASE: $this->_registerDispute(); break; - // handle new adjustment is created + // handle new adjustment is created case Info::TXN_TYPE_ADJUSTMENT: $this->_registerAdjustment(); break; - //handle new transaction created + //handle new transaction created default: $this->_registerTransaction(); break; @@ -239,16 +239,16 @@ protected function _registerTransaction() case Info::PAYMENTSTATUS_COMPLETED: $this->_registerPaymentCapture(true); break; - // the holded payment was denied on paypal side + // the holded payment was denied on paypal side case Info::PAYMENTSTATUS_DENIED: $this->_registerPaymentDenial(); break; - // customer attempted to pay via bank account, but failed + // customer attempted to pay via bank account, but failed case Info::PAYMENTSTATUS_FAILED: // cancel order $this->_registerPaymentFailure(); break; - // payment was obtained, but money were not captured yet + // payment was obtained, but money were not captured yet case Info::PAYMENTSTATUS_PENDING: $this->_registerPaymentPending(); break; @@ -263,7 +263,7 @@ protected function _registerTransaction() case Info::PAYMENTSTATUS_REFUNDED: $this->_registerPaymentRefund(); break; - // authorization expire/void + // authorization expire/void case Info::PAYMENTSTATUS_EXPIRED: // break is intentionally omitted case Info::PAYMENTSTATUS_VOIDED: @@ -288,24 +288,12 @@ protected function _registerPaymentCapture($skipFraudDetection = false) $parentTransactionId = $this->getRequestData('parent_txn_id'); $this->_importPaymentInformation(); $payment = $this->_order->getPayment(); - $payment->setTransactionId( - $this->getRequestData('txn_id') - ); - $payment->setCurrencyCode( - $this->getRequestData('mc_currency') - ); - $payment->setPreparedMessage( - $this->_createIpnComment('') - ); - $payment->setParentTransactionId( - $parentTransactionId - ); - $payment->setShouldCloseParentTransaction( - 'Completed' === $this->getRequestData('auth_status') - ); - $payment->setIsTransactionClosed( - 0 - ); + $payment->setTransactionId($this->getRequestData('txn_id')); + $payment->setCurrencyCode($this->getRequestData('mc_currency')); + $payment->setPreparedMessage($this->_createIpnComment('')); + $payment->setParentTransactionId($parentTransactionId); + $payment->setShouldCloseParentTransaction('Completed' === $this->getRequestData('auth_status')); + $payment->setIsTransactionClosed(0); $payment->registerCaptureNotification( $this->getRequestData('mc_gross'), $skipFraudDetection && $parentTransactionId @@ -318,9 +306,9 @@ protected function _registerPaymentCapture($skipFraudDetection = false) $this->orderSender->send($this->_order); $this->_order->addStatusHistoryComment( __('You notified customer about invoice #%1.', $invoice->getIncrementId()) - )->setIsCustomerNotified( - true - )->save(); + ) + ->setIsCustomerNotified(true) + ->save(); } } @@ -334,15 +322,13 @@ protected function _registerPaymentDenial() { try { $this->_importPaymentInformation(); - $this->_order->getPayment()->setTransactionId( - $this->getRequestData('txn_id') - )->setNotificationResult( - true - )->setIsTransactionClosed( - true - )->deny(false); + $this->_order->getPayment() + ->setTransactionId($this->getRequestData('txn_id')) + ->setNotificationResult(true) + ->setIsTransactionClosed(true) + ->deny(false); $this->_order->save(); - } catch (\Magento\Framework\Exception\LocalizedException $e) { + } catch (LocalizedException $e) { if ($e->getMessage() != __('We cannot cancel this order.')) { throw $e; } @@ -386,13 +372,11 @@ public function _registerPaymentPending() $this->_importPaymentInformation(); - $this->_order->getPayment()->setPreparedMessage( - $this->_createIpnComment($this->_paypalInfo->explainPendingReason($reason)) - )->setTransactionId( - $this->getRequestData('txn_id') - )->setIsTransactionClosed( - 0 - )->update(false); + $this->_order->getPayment() + ->setPreparedMessage($this->_createIpnComment($this->_paypalInfo->explainPendingReason($reason))) + ->setTransactionId($this->getRequestData('txn_id')) + ->setIsTransactionClosed(0) + ->update(false); $this->_order->save(); } @@ -409,19 +393,12 @@ protected function _registerPaymentAuthorization() $payment->update(true); } else { $this->_importPaymentInformation(); - $payment->setPreparedMessage( - $this->_createIpnComment('') - )->setTransactionId( - $this->getRequestData('txn_id') - )->setParentTransactionId( - $this->getRequestData('parent_txn_id') - )->setCurrencyCode( - $this->getRequestData('mc_currency') - )->setIsTransactionClosed( - 0 - )->registerAuthorizationNotification( - $this->getRequestData('mc_gross') - ); + $payment->setPreparedMessage($this->_createIpnComment('')) + ->setTransactionId($this->getRequestData('txn_id')) + ->setParentTransactionId($this->getRequestData('parent_txn_id')) + ->setCurrencyCode($this->getRequestData('mc_currency')) + ->setIsTransactionClosed(0) + ->registerAuthorizationNotification($this->getRequestData('mc_gross')); } if (!$this->_order->getEmailSent()) { $this->orderSender->send($this->_order); @@ -449,12 +426,13 @@ protected function _registerPaymentReversal() { $reasonCode = $this->getRequestData('reason_code'); $reasonComment = $this->_paypalInfo->explainReasonCode($reasonCode); - $notificationAmount = $this->_order->getBaseCurrency()->formatTxt( - $this->getRequestData('mc_gross') + $this->getRequestData('mc_fee') - ); + $notificationAmount = $this->_order->getBaseCurrency() + ->formatTxt( + $this->getRequestData('mc_gross') + $this->getRequestData('mc_fee') + ); $paymentStatus = $this->_filterPaymentStatus($this->getRequestData('payment_status')); $orderStatus = $paymentStatus == - Info::PAYMENTSTATUS_REVERSED ? Info::ORDER_STATUS_REVERSED : Info::ORDER_STATUS_CANCELED_REVERSAL; + Info::PAYMENTSTATUS_REVERSED ? Info::ORDER_STATUS_REVERSED : Info::ORDER_STATUS_CANCELED_REVERSAL; //Change order status to PayPal Reversed/PayPal Cancelled Reversal if it is possible. $message = __( 'IPN "%1". %2 Transaction amount %3. Transaction ID: "%4"', @@ -464,8 +442,9 @@ protected function _registerPaymentReversal() $this->getRequestData('txn_id') ); $this->_order->setStatus($orderStatus); - $this->_order->save(); - $this->_order->addStatusHistoryComment($message, $orderStatus)->setIsCustomerNotified(false)->save(); + $this->_order->addStatusHistoryComment($message, $orderStatus) + ->setIsCustomerNotified(false) + ->save(); } /** @@ -478,17 +457,12 @@ protected function _registerPaymentRefund() $this->_importPaymentInformation(); $reason = $this->getRequestData('reason_code'); $isRefundFinal = !$this->_paypalInfo->isReversalDisputable($reason); - $payment = $this->_order->getPayment()->setPreparedMessage( - $this->_createIpnComment($this->_paypalInfo->explainReasonCode($reason)) - )->setTransactionId( - $this->getRequestData('txn_id') - )->setParentTransactionId( - $this->getRequestData('parent_txn_id') - )->setIsTransactionClosed( - $isRefundFinal - )->registerRefundNotification( - -1 * $this->getRequestData('mc_gross') - ); + $payment = $this->_order->getPayment() + ->setPreparedMessage($this->_createIpnComment($this->_paypalInfo->explainReasonCode($reason))) + ->setTransactionId($this->getRequestData('txn_id')) + ->setParentTransactionId($this->getRequestData('parent_txn_id')) + ->setIsTransactionClosed($isRefundFinal) + ->registerRefundNotification(-1 * $this->getRequestData('mc_gross')); $this->_order->save(); // TODO: there is no way to close a capture right now @@ -498,9 +472,9 @@ protected function _registerPaymentRefund() $this->creditmemoSender->send($creditMemo); $this->_order->addStatusHistoryComment( __('You notified customer about creditmemo #%1.', $creditMemo->getIncrementId()) - )->setIsCustomerNotified( - true - )->save(); + ) + ->setIsCustomerNotified(true) + ->save(); } } @@ -513,19 +487,14 @@ protected function _registerPaymentVoid() { $this->_importPaymentInformation(); - $parentTxnId = $this->getRequestData( - 'transaction_entity' - ) == 'auth' ? $this->getRequestData( - 'txn_id' - ) : $this->getRequestData( - 'parent_txn_id' - ); + $parentTxnId = $this->getRequestData('transaction_entity') == 'auth' + ? $this->getRequestData('txn_id') + : $this->getRequestData('parent_txn_id'); - $this->_order->getPayment()->setPreparedMessage( - $this->_createIpnComment('') - )->setParentTransactionId( - $parentTxnId - )->registerVoidNotification(); + $this->_order->getPayment() + ->setPreparedMessage($this->_createIpnComment('')) + ->setParentTransactionId($parentTxnId) + ->registerVoidNotification(); $this->_order->save(); } @@ -546,14 +515,14 @@ protected function _importPaymentInformation() // collect basic information $from = []; foreach ([ - Info::PAYER_ID, - 'payer_email' => Info::PAYER_EMAIL, - Info::PAYER_STATUS, - Info::ADDRESS_STATUS, - Info::PROTECTION_EL, - Info::PAYMENT_STATUS, - Info::PENDING_REASON, - ] as $privateKey => $publicKey) { + Info::PAYER_ID, + 'payer_email' => Info::PAYER_EMAIL, + Info::PAYER_STATUS, + Info::ADDRESS_STATUS, + Info::PROTECTION_EL, + Info::PAYMENT_STATUS, + Info::PENDING_REASON, + ] as $privateKey => $publicKey) { if (is_int($privateKey)) { $privateKey = $publicKey; } diff --git a/app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php b/app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php index ee12b459118c1..d38e58d7341c1 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php +++ b/app/code/Magento/Sales/Model/Order/Payment/State/RegisterCaptureNotificationCommand.php @@ -35,7 +35,7 @@ public function __construct(StatusResolver $statusResolver = null) */ public function execute(OrderPaymentInterface $payment, $amount, OrderInterface $order) { - $state = Order::STATE_PROCESSING; + $state = $order->getState() ?: Order::STATE_PROCESSING; $status = null; $message = 'Registered notification about captured amount of %1.'; diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php index 32ea9d8869344..6520ae1dbd2d8 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php @@ -32,26 +32,29 @@ class RegisterCaptureNotificationCommandTest extends \PHPUnit\Framework\TestCase * * @param bool $isTransactionPending * @param bool $isFraudDetected + * @param string $currentState * @param string $expectedState * @param string $expectedStatus * @param string $expectedMessage - * + * @return void * @dataProvider commandResultDataProvider */ public function testExecute( $isTransactionPending, $isFraudDetected, + $currentState, $expectedState, $expectedStatus, $expectedMessage - ) { + ): void { + $order = $this->getOrder($currentState); $actualReturn = (new RegisterCaptureNotificationCommand($this->getStatusResolver()))->execute( $this->getPayment($isTransactionPending, $isFraudDetected), $this->amount, - $this->getOrder() + $order ); - $this->assertOrderStateAndStatus($this->getOrder(), $expectedState, $expectedStatus); + $this->assertOrderStateAndStatus($order, $expectedState, $expectedStatus); self::assertEquals(__($expectedMessage, $this->amount), $actualReturn); } @@ -64,30 +67,42 @@ public function commandResultDataProvider() [ false, false, + Order::STATE_COMPLETE, + Order::STATE_COMPLETE, + $this->newOrderStatus, + 'Registered notification about captured amount of %1.', + ], + [ + false, + false, + null, Order::STATE_PROCESSING, $this->newOrderStatus, - 'Registered notification about captured amount of %1.' + 'Registered notification about captured amount of %1.', ], [ true, false, + Order::STATE_PROCESSING, Order::STATE_PAYMENT_REVIEW, $this->newOrderStatus, - 'An amount of %1 will be captured after being approved at the payment gateway.' + 'An amount of %1 will be captured after being approved at the payment gateway.', ], [ false, true, + Order::STATE_PROCESSING, Order::STATE_PAYMENT_REVIEW, Order::STATUS_FRAUD, - 'Order is suspended as its capture amount %1 is suspected to be fraudulent.' + 'Order is suspended as its capture amount %1 is suspected to be fraudulent.', ], [ true, true, + Order::STATE_PROCESSING, Order::STATE_PAYMENT_REVIEW, Order::STATUS_FRAUD, - 'Order is suspended as its capture amount %1 is suspected to be fraudulent.' + 'Order is suspended as its capture amount %1 is suspected to be fraudulent.', ], ]; } @@ -107,15 +122,19 @@ private function getStatusResolver() } /** + * @param string|null $state * @return Order|MockObject */ - private function getOrder() + private function getOrder($state) { + /** @var Order|MockObject $order */ $order = $this->getMockBuilder(Order::class) ->disableOriginalConstructor() + ->setMethods(['getBaseCurrency', 'getOrderStatusByState']) ->getMock(); $order->method('getBaseCurrency') ->willReturn($this->getCurrency()); + $order->setState($state); return $order; } @@ -159,7 +178,7 @@ private function getCurrency() */ private function assertOrderStateAndStatus($order, $expectedState, $expectedStatus) { - $order->method('setState')->with($expectedState); - $order->method('setStatus')->with($expectedStatus); + self::assertEquals($expectedState, $order->getState(), 'The order {state} should match.'); + self::assertEquals($expectedStatus, $order->getStatus(), 'The order {status} should match.'); } } From b02161b60261ca13292c79db5d38dc1c8da10fb6 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@transoftgroup.com> Date: Thu, 7 Jun 2018 12:39:31 +0300 Subject: [PATCH 073/133] MAGETWO-92137: Refreshing page deletes shipping address on guest checkout if module-persistent is enabled --- .../Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml index f1499d14e1fc6..f7f76da7d3895 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Persistent/Test/GuestCheckoutWithEnabledPersistentTest.xml @@ -62,7 +62,7 @@ <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="guestSelectCheckMoneyOrderPayment" /> <!-- Reload payment section --> <amOnPage url="{{GuestCheckoutReviewAndPaymentsPage.url}}" stepKey="amOnCheckoutPaymentsPage"/> - <waitForPageLoad stepKey="waitForPaymentPageReload"/> + <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton2"/> <!-- Check that address block contains correct information --> <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.firstName}}" stepKey="seeBilllingFirstName" /> <see selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{CustomerAddressSimple.lastName}}" stepKey="seeBilllingLastName" /> From 252e075c8d2601c475237fe7d16f09431445a1ca Mon Sep 17 00:00:00 2001 From: Stas Kozar <stas.kozar@transoftgroup.com> Date: Thu, 7 Jun 2018 16:02:06 +0300 Subject: [PATCH 074/133] MAGETWO-90761: [2.3.0] PayPal orders status display always as Processing --- .../State/RegisterCaptureNotificationCommandTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php index 6520ae1dbd2d8..1b762fafe0b71 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/State/RegisterCaptureNotificationCommandTest.php @@ -32,7 +32,7 @@ class RegisterCaptureNotificationCommandTest extends \PHPUnit\Framework\TestCase * * @param bool $isTransactionPending * @param bool $isFraudDetected - * @param string $currentState + * @param string|null $currentState * @param string $expectedState * @param string $expectedStatus * @param string $expectedMessage @@ -40,12 +40,12 @@ class RegisterCaptureNotificationCommandTest extends \PHPUnit\Framework\TestCase * @dataProvider commandResultDataProvider */ public function testExecute( - $isTransactionPending, - $isFraudDetected, + bool $isTransactionPending, + bool $isFraudDetected, $currentState, - $expectedState, - $expectedStatus, - $expectedMessage + string $expectedState, + string $expectedStatus, + string $expectedMessage ): void { $order = $this->getOrder($currentState); $actualReturn = (new RegisterCaptureNotificationCommand($this->getStatusResolver()))->execute( From 4c5410a7fccc73f45107b3a7720335d6f41d05b5 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Thu, 7 Jun 2018 09:09:23 -0500 Subject: [PATCH 075/133] MC-181: Configurable Product goes "Out of Stock" if all associated Simple Products are "Out of Stock" - Change the quantity using the GUI rather than the API --- .../Data/ProductExtensionAttributeData.xml | 3 - .../Catalog/Data/StockItemData.xml | 4 -- .../Data/SimpleProductData.xml | 37 ------------ .../StorefrontProductInfoMainSection.xml | 2 +- ...AdminConfigurableProductOutOfStockTest.xml | 57 ++++++++++++++++--- 5 files changed, 50 insertions(+), 53 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/SimpleProductData.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductExtensionAttributeData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductExtensionAttributeData.xml index b45dd1ccbcd0f..39cd17effeffc 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductExtensionAttributeData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductExtensionAttributeData.xml @@ -11,7 +11,4 @@ <entity name="EavStockItem" type="product_extension_attribute"> <requiredEntity type="stock_item">Qty_1000</requiredEntity> </entity> - <entity name="NoStockItem" type="product_extension_attribute"> - <requiredEntity type="stock_item">Qty_0</requiredEntity> - </entity> </entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StockItemData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StockItemData.xml index 14ac7207d4586..d76370d4ea0d2 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StockItemData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StockItemData.xml @@ -12,8 +12,4 @@ <data key="qty">1000</data> <data key="is_in_stock">true</data> </entity> - <entity name="Qty_0" type="stock_item"> - <data key="qty">0</data> - <data key="is_in_stock">false</data> - </entity> </entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/SimpleProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/SimpleProductData.xml deleted file mode 100644 index 0557379aa4cfd..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Data/SimpleProductData.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?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="ApiSimpleProductNoQuantityOne" type="product2"> - <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">123.00</data> - <data key="urlKey" unique="suffix">api-simple-product</data> - <data key="status">1</data> - <data key="quantity">0</data> - <requiredEntity type="product_extension_attribute">NoStockItem</requiredEntity> - <requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity> - </entity> - <entity name="ApiSimpleProductNoQuantityTwo" type="product2"> - <data key="sku" unique="suffix">api-simple-product-two</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 Two</data> - <data key="price">234.00</data> - <data key="urlKey" unique="suffix">api-simple-product-two</data> - <data key="status">1</data> - <data key="quantity">0</data> - <requiredEntity type="product_extension_attribute">NoStockItem</requiredEntity> - <requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity> - </entity> -</entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml index 4a1b75289f215..e3b1a2a349eab 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Section/StorefrontProductInfoMainSection.xml @@ -14,6 +14,6 @@ <element name="productAttributeOptions1" type="select" selector="#product-options-wrapper div[tabindex='0'] option"/> <element name="productAttributeOptionsSelectButton" type="select" selector="#product-options-wrapper .super-attribute-select"/> <element name="productAttributeOptionsError" type="text" selector="//div[@class='mage-error']"/> - <element name="outOfStockError" type="block" selector=".unavailable" /> + <element name="stockIndication" type="block" selector=".stock" /> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml index 2539f6e8bd554..28cc3132bca11 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml @@ -11,11 +11,11 @@ <test name="AdminConfigurableProductOutOfStockTest"> <annotations> <features value="ConfigurableProduct"/> - <stories value="Out Of Stock"/> + <stories value="Product visibility when in stock/out of stock"/> <title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> <description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> <testCaseId value="MC-181"/> - <group value="ConfigurableProduct"/> + <group value="Catalog"/> </annotations> <before> <!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. --> @@ -46,11 +46,11 @@ </getData> <!-- Create the 2 children that will be a part of the configurable product --> - <createData entity="ApiSimpleProductNoQuantityOne" stepKey="createConfigChildProduct1"> + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> <requiredEntity createDataKey="createConfigProductAttribute"/> <requiredEntity createDataKey="getConfigAttributeOption1"/> </createData> - <createData entity="ApiSimpleProductNoQuantityTwo" stepKey="createConfigChildProduct2"> + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> <requiredEntity createDataKey="createConfigProductAttribute"/> <requiredEntity createDataKey="getConfigAttributeOption2"/> </createData> @@ -83,11 +83,52 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> </after> - <!-- ADD TEST STEPS HERE --> + + <!-- Check to make sure that the configurable product shows up as in stock --> + <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/> + <waitForPageLoad stepKey="waitForStoreFrontLoad"/> + <see stepKey="lookForOutOfStock" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK" /> + + <!-- Find the first simple product that we just created using the product grid and go to its page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForAdminProductGridLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> + <argument name="product" value="ApiSimpleOne"/> + </actionGroup> + <waitForPageLoad stepKey="waitForFiltersToBeApplied"/> + <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + + <!-- Edit the quantity of the simple first product as 0 --> + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="fillProductQuantity"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/> + <waitForPageLoad stepKey="waitForProductPageSaved"/> + + <!-- Check to make sure that the configurable product shows up as in stock --> + <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage2"/> + <waitForPageLoad stepKey="waitForStoreFrontLoad2"/> + <see stepKey="lookForOutOfStock2" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="IN STOCK"/> + + <!-- Find the second simple product that we just created using the product grid and go to its page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage2"/> + <waitForPageLoad stepKey="waitForAdminProductGridLoad2"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/> + <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct2"> + <argument name="product" value="ApiSimpleTwo"/> + </actionGroup> + <waitForPageLoad stepKey="waitForFiltersToBeApplied2"/> + <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage2"/> + <waitForPageLoad stepKey="waitForProductPageLoad2"/> + + <!-- Edit the quantity of the second simple product as 0 --> + <fillField selector="{{AdminProductFormSection.productQuantity}}" userInput="0" stepKey="fillProductQuantity2"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct2"/> + <waitForPageLoad stepKey="waitForProductPageSaved2"/> <!-- Check to make sure that the configurable product shows up as out of stock --> - <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage" /> - <waitForPageLoad stepKey="waitForStoreFrontLoad" /> - <see stepKey="lookForOutOfStock" selector="{{StorefrontProductInfoMainSection.outOfStockError}}" userInput="OUT OF STOCK" /> + <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage3"/> + <waitForPageLoad stepKey="waitForStoreFrontLoad3"/> + <see stepKey="lookForOutOfStock3" selector="{{StorefrontProductInfoMainSection.stockIndication}}" userInput="OUT OF STOCK"/> </test> </tests> From 8a5ff8f422a0d607a291c1b9d4d1d8eb78597a50 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Thu, 7 Jun 2018 10:13:36 -0500 Subject: [PATCH 076/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - CR notes --- .../Controller/Adminhtml/Product/Attribute/Save.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index d78b6aaf45cfd..eeba203b6ee63 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -125,7 +125,7 @@ public function execute() { $data = $this->getRequest()->getPostValue(); if ($data) { - $this->extractOptionsData($data); + $this->preprocessOptionsData($data); $setId = $this->getRequest()->getParam('set'); $attributeSet = null; @@ -318,7 +318,7 @@ public function execute() } /** - * Extract options data from serialized options field. + * Extract options data from serialized options field and append to data array. * * This logic is required to overcome max_input_vars php limit * that may vary and/or be inaccessible to change on different instances. @@ -326,10 +326,9 @@ public function execute() * @param array $data * @return void */ - private function extractOptionsData(&$data) + private function preprocessOptionsData(&$data) { if (isset($data['serialized_options'])) { - unset($data['option']); $serializedOptions = json_decode($data['serialized_options'], JSON_OBJECT_AS_ARRAY); foreach ($serializedOptions as $serializedOption) { $option = []; @@ -337,6 +336,7 @@ private function extractOptionsData(&$data) $data = array_merge_recursive($data, $option); } } + unset($data['serialized_options']); } /** From e38ac268cc3372fcdb951df57bc85134115be4b0 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Thu, 7 Jun 2018 10:17:51 -0500 Subject: [PATCH 077/133] MC-181: Configurable Product goes "Out of Stock" if all associated Simple Products are "Out of Stock" - renamed group --- .../Test/AdminConfigurableProductOutOfStockTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml index 28cc3132bca11..96651e303c5f2 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductOutOfStockTest.xml @@ -15,7 +15,7 @@ <title value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> <description value="Configurable Product goes 'Out of Stock' if all associated Simple Products are 'Out of Stock'"/> <testCaseId value="MC-181"/> - <group value="Catalog"/> + <group value="ConfigurableProduct"/> </annotations> <before> <!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. --> From 718a699169dc3a1382010b620e09edf84d9314b3 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Thu, 7 Jun 2018 10:54:01 -0500 Subject: [PATCH 078/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - CR notes --- app/code/Magento/Catalog/view/adminhtml/web/js/options.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index 5f7ca36aace84..d59b8fc4663bc 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -181,8 +181,7 @@ define([ }); } editForm.on('submit', function () { - editForm - .find('#manage-options-panel input[name^="option"]') + optionPanel.find('input[name^="option"]') .each(function() { optionsValues.push(this.name + '=' + jQuery(this).val()); }); From 2722448482cd5f38c73b7d9d0cd3babfbf31cbbd Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 1 Jun 2018 15:45:05 -0500 Subject: [PATCH 079/133] MC-248: Admin should be able to create simple product with two custom options - Initial file upload --- .../Section/AdminCustomOptionsSection.xml | 14 +++++++ .../Test/SimpleProductTwoCustomOptions.xml | 41 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptions.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml new file mode 100644 index 0000000000000..63aab82730238 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections 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="AdminCustomOptionsSection"> + <element name="customizableOptions" type="block" selector="//div//span[text() = 'Customizable Options']"/> + </section> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptions.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptions.xml new file mode 100644 index 0000000000000..3c6ff000bf99c --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptions.xml @@ -0,0 +1,41 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="SimpleProductTwoCustomOptions"> + <annotations> + <title value="Create simple product with two custom options"/> + <description value="Admin should be able to create simple product with two custom options"/> + <severity value="AVERAGE"/> + <testCaseId value="MC-248"/> + <group value="Levi"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> + </after> + <!-- ADD TEST STEPS HERE --> + + <!--Create product--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPage"/> + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateSimpleProduct"> + <argument name="product" value="SimpleProduct3"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillSimpleProductMain"> + <argument name="product" value="SimpleProduct3"/> + </actionGroup> + + <click stepKey="clickCustomizableOptions" selector="{{AdminCustomOptionsSection.customizableOptions}}" /> + + </test> +</tests> From 92e925e68b208f3df790c4f302a50d1fce43ef04 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Thu, 7 Jun 2018 10:55:35 -0500 Subject: [PATCH 080/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - CR notes --- app/code/Magento/Catalog/view/adminhtml/web/js/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index d59b8fc4663bc..6fb0c419956d8 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -181,7 +181,7 @@ define([ }); } editForm.on('submit', function () { - optionPanel.find('input[name^="option"]') + optionPanel.find('input') .each(function() { optionsValues.push(this.name + '=' + jQuery(this).val()); }); From 40e12d980f28de2315d68dc02f388dffde344b22 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Mon, 4 Jun 2018 10:23:15 -0500 Subject: [PATCH 081/133] MC-248: Admin should be able to create simple product with two custom options - Create the elements to be used in the custom options section --- .../Catalog/Section/AdminCustomOptionsSection.xml | 14 ++++++++++++-- ...s.xml => SimpleProductTwoCustomOptionsTest.xml} | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) rename dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/{SimpleProductTwoCustomOptions.xml => SimpleProductTwoCustomOptionsTest.xml} (97%) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml index 63aab82730238..406fb0080ee49 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml @@ -9,6 +9,16 @@ <sections 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="AdminCustomOptionsSection"> - <element name="customizableOptions" type="block" selector="//div//span[text() = 'Customizable Options']"/> + <element name="customizableOptions" type="block" selector="div[data-index='custom_options']"/> + <element name="addOption" type="button" selector="div[data-index='custom_options'] button.action-basic"/> + + <element name="optionTitle" type="input" selector=".data-row:last-of-type ._required input" /> + <element name="optionTypeParent" type="block" selector=".data-row:last-of-type .admin__action-multiselect-text" /> + <element name="addValue" type="button" selector=".data-row:last-of-type [data-action='add_new_row']" /> + <element name="valueTitle" type="input" selector=".data-row:last-of-type [data-index='title] input" /> + <element name="valuePrice" type="input" selector=".data-row:last-of-type [data-index='price'] input" /> + + <element name="radioButton" type="block" selector="//label[text()='Radio Buttons'][ancestor::*[contains(@class, '_active')]]" /> + </section> -</sections> +</sections> \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptions.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml similarity index 97% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptions.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml index 3c6ff000bf99c..0d2f8e184e54b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptions.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml @@ -37,5 +37,7 @@ <click stepKey="clickCustomizableOptions" selector="{{AdminCustomOptionsSection.customizableOptions}}" /> + + </test> </tests> From 7ee5a8bf0389fd18fb68f6eb41874073cd1fb097 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Tue, 5 Jun 2018 10:47:33 -0500 Subject: [PATCH 082/133] MC-248: Admin should be able to create simple product with two custom options - Finish creating the test --- .../ActionGroup/CustomOptionsActionGroup.xml | 48 ++++++++++++++ .../Catalog/Data/ProductOptionData.xml | 11 ++++ .../Section/AdminCustomOptionsSection.xml | 24 ------- ...AdminProductCustomizableOptionsSection.xml | 9 +++ .../StorefrontProductInfoMainSection.xml | 7 +++ .../SimpleProductTwoCustomOptionsTest.xml | 63 ++++++++++++++++--- 6 files changed, 128 insertions(+), 34 deletions(-) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml new file mode 100644 index 0000000000000..d7e8f42d6d302 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml @@ -0,0 +1,48 @@ +<?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="categoryName"/> + <argument name="productOption"/> + <argument name="productOption2"/> + </arguments> + + <!-- opens the custom option panel and clicks add options --> + <click stepKey="openCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}" /> + <click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" /> + + <!-- Fill in the option and select the type of radio (once) --> + <fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{categoryName}}" /> + <click stepKey="clickOptionTypeParent" selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" /> + <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}}" /> + + <!-- close the custom option dropdown --> + <click stepKey="closeCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}" /> + + </actionGroup> + +</actionGroups> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml index f2f6e1a6f552f..31a6ceaf2ac7c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml @@ -18,6 +18,17 @@ <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> + <data key="expected_value">153.00</data> <!-- tied to this price and ProductOptionField --> + </entity> <entity name="ProductOptionArea" type="product_option"> <var key="product_sku" entityType="product" entityKey="sku" /> <data key="title">OptionArea</data> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml deleted file mode 100644 index 406fb0080ee49..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCustomOptionsSection.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<sections 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="AdminCustomOptionsSection"> - <element name="customizableOptions" type="block" selector="div[data-index='custom_options']"/> - <element name="addOption" type="button" selector="div[data-index='custom_options'] button.action-basic"/> - - <element name="optionTitle" type="input" selector=".data-row:last-of-type ._required input" /> - <element name="optionTypeParent" type="block" selector=".data-row:last-of-type .admin__action-multiselect-text" /> - <element name="addValue" type="button" selector=".data-row:last-of-type [data-action='add_new_row']" /> - <element name="valueTitle" type="input" selector=".data-row:last-of-type [data-index='title] input" /> - <element name="valuePrice" type="input" selector=".data-row:last-of-type [data-index='price'] input" /> - - <element name="radioButton" type="block" selector="//label[text()='Radio Buttons'][ancestor::*[contains(@class, '_active')]]" /> - - </section> -</sections> \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCustomizableOptionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCustomizableOptionsSection.xml index 703ba081e3123..2bd5158941180 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCustomizableOptionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCustomizableOptionsSection.xml @@ -23,5 +23,14 @@ <element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//span[text()='Price Type']/parent::label/parent::div//select" parameterized="true"/> <element name="checkboxUseDefaultTitle" type="checkbox" selector="//span[text()='Option Title']/parent::label/parent::div/div//input[@type='checkbox']"/> <element name="checkboxUseDefaultOption" type="checkbox" selector="//table[@data-index='values']//tbody//tr[@data-repeat-index='{{var1}}']//div[@class='admin__field-control']//input[@type='checkbox']" parameterized="true"/> + + <!-- Elements that make it easier to select the most recently added element --> + <element name="lastOptionTitle" type="input" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr[last()]//*[contains(@class, '_required')]//input" /> + <element name="lastOptionTypeParent" type="block" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr[last()]//*[contains(@class, 'admin__action-multiselect-text')]" /> + <!-- var 1 represents the option type that you want to select, i.e "radio buttons" --> + <element name="optionType" type="block" selector="//*[@data-index='custom_options']//label[text()='{{var1}}'][ancestor::*[contains(@class, '_active')]]" parameterized="true" /> + <element name="addValue" type="button" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr[last()]//*[@data-action='add_new_row']" /> + <element name="valueTitle" type="input" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr[last()]//*[contains(@class, 'admin__control-table')]//tbody/tr[last()]//*[@data-index='title']//input" /> + <element name="valuePrice" type="input" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr[last()]//*[contains(@class, 'admin__control-table')]//tbody/tr[last()]//*[@data-index='price']//input" /> </section> </sections> \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml index 5abc388a7d65d..bcbdc22c2eaa0 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml @@ -23,7 +23,14 @@ <element name="productOptionAreaInput" type="textarea" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//textarea" parameterized="true"/> <element name="productOptionFile" type="file" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'OptionFile')]/../div[@class='control']//input[@type='file']" parameterized="true"/> <element name="productOptionSelect" type="select" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//select" parameterized="true"/> + + + <!-- The parameter is the nth custom option that you want to get --> + <element name="nthCustomOption" type="block" selector="//*[@id='product-options-wrapper']/*[@class='fieldset']/*[contains(@class, 'field')][{{customOptionNum}}]" parameterized="true" /> + <!-- The 1st parameter is the nth custom option, the 2nd parameter is the nth value in the option --> + <element name="nthCustomOptionInput" type="radio" selector="//*[@id='product-options-wrapper']/*[@class='fieldset']/*[contains(@class, 'field')][{{customOptionNum}}]//*[contains(@class, 'admin__field-option')][{{customOptionValueNum}}]//input" parameterized="true" /> <element name="productOptionRadioButtonsCheckbox" type="checkbox" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//input[@price='{{var2}}']" parameterized="true"/> + <element name="productOptionDataMonth" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='month']" parameterized="true"/> <element name="productOptionDataDay" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='day']" parameterized="true"/> <element name="productOptionDataYear" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='year']" parameterized="true"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml index 0d2f8e184e54b..5b70374b92e7c 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml @@ -10,34 +10,77 @@ xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> <test name="SimpleProductTwoCustomOptions"> <annotations> - <title value="Create simple product with two custom options"/> + <features value="CustomOptions" /> + <stories value="Create simple product with two custom options" /> + <title value="Admin should be able to create simple product with two custom options"/> <description value="Admin should be able to create simple product with two custom options"/> <severity value="AVERAGE"/> <testCaseId value="MC-248"/> <group value="Levi"/> </annotations> <before> + <!-- log in as admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!--Create product--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad stepKey="waitForProductIndexPage"/> + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateSimpleProduct"> + <argument name="product" value="SimpleProduct3"/> + </actionGroup> + <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillSimpleProductMain"> + <argument name="product" value="SimpleProduct3"/> + </actionGroup> </before> <after> + <!-- Delete the created product --> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct"> + <argument name="product" value="SimpleProduct3"/> + </actionGroup> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> </after> <!-- ADD TEST STEPS HERE --> - <!--Create product--> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <waitForPageLoad stepKey="waitForProductIndexPage"/> - <actionGroup ref="resetProductGridToDefaultView" stepKey="resetProductGridColumnsInitial"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateSimpleProduct"> - <argument name="product" value="SimpleProduct3"/> + <!-- Create a custom option with 2 values --> + <actionGroup ref="CreateCustomRadioOptions" stepKey="createCustomOption1"> + <argument name="categoryName" value="ProductOptionRadiobutton.title"/> + <argument name="productOption" value="ProductOptionField"/> + <argument name="productOption2" value="ProductOptionField2"/> </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillSimpleProductMain"> - <argument name="product" value="SimpleProduct3"/> + + <!-- Create another custom option with 2 values --> + <actionGroup ref="CreateCustomRadioOptions" stepKey="createCustomOption2"> + <argument name="categoryName" value="ProductOptionRadiobutton.title"/> + <argument name="productOption" value="ProductOptionField"/> + <argument name="productOption2" value="ProductOptionField2"/> </actionGroup> - <click stepKey="clickCustomizableOptions" selector="{{AdminCustomOptionsSection.customizableOptions}}" /> + <!-- Save the product --> + <click stepKey="saveProduct" selector="{{AdminProductFormActionSection.saveButton}}" /> + <waitForPageLoad stepKey="waitForProductSaved" /> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/> + + <!-- navigate to the created product page --> + <amOnPage url="/{{SimpleProduct3.name}}.html" stepKey="goToCreatedProduct" /> + <waitForPageLoad stepKey="waitForProductPageLoad" /> + + <!-- Check to make sure all of the created names are there --> + <see stepKey="assertNameInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField.title}}" /> + <see stepKey="assertNameInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField.title}}" /> + <see stepKey="assertSecondNameInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField2.title}}" /> + <see stepKey="assertSecondNameInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField2.title}}" /> + <!-- Check to see that all of the created prices are there --> + <see stepKey="assertPriceInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField.price}}" /> + <see stepKey="assertPriceInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField.price}}" /> + <see stepKey="assertSecondPriceInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField2.price}}" /> + <see stepKey="assertSecondPriceInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField2.price}}" /> + <!-- select two of the radio buttons --> + <click stepKey="selectFirstCustomOption" selector="{{StorefrontProductInfoMainSection.nthCustomOptionInput('1','2')}}" /> + <click stepKey="selectSecondCustomOption" selector="{{StorefrontProductInfoMainSection.nthCustomOptionInput('2','1')}}" /> + <!-- Check that the price has actually changed --> + <see stepKey="assertPriceHasChanged" selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{ProductOptionField2.expected_value}}" /> </test> </tests> From 784c1e16c58af1a32684da12087bc34c6b4bb9eb Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Thu, 7 Jun 2018 10:46:38 -0500 Subject: [PATCH 083/133] MC-248: Admin should be able to create simple product with two custom options - Cleaned up naming --- .../ActionGroup/CustomOptionsActionGroup.xml | 26 ++++++------ .../Catalog/Data/ProductOptionData.xml | 1 - .../SimpleProductTwoCustomOptionsTest.xml | 40 +++++++++---------- 3 files changed, 33 insertions(+), 34 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml index d7e8f42d6d302..770e50023689a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml @@ -15,33 +15,33 @@ <!-- ActionGroup will add a single custom option to a product --> <!-- You must already be on the product creation page --> <arguments> - <argument name="categoryName"/> + <argument name="customOptionName"/> <argument name="productOption"/> <argument name="productOption2"/> </arguments> <!-- opens the custom option panel and clicks add options --> - <click stepKey="openCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}" /> - <click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}" /> + <click stepKey="openCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}"/> + <click stepKey="clickAddOptions" selector="{{AdminProductCustomizableOptionsSection.addOptionBtn}}"/> <!-- Fill in the option and select the type of radio (once) --> - <fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{categoryName}}" /> - <click stepKey="clickOptionTypeParent" selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}" /> - <click stepKey="clickOptionType" selector="{{AdminProductCustomizableOptionsSection.optionType('Radio Buttons')}}" /> + <fillField stepKey="fillInOptionTitle" selector="{{AdminProductCustomizableOptionsSection.lastOptionTitle}}" userInput="{{customOptionName}}"/> + <click stepKey="clickOptionTypeParent" selector="{{AdminProductCustomizableOptionsSection.lastOptionTypeParent}}"/> + <click stepKey="clickOptionType" selector="{{AdminProductCustomizableOptionsSection.optionType('Radio Buttons')}}"/> <!-- Add three radio options based on the parameter --> - <click stepKey="clickAddValue" selector="{{AdminProductCustomizableOptionsSection.addValue}}" /> + <click stepKey="clickAddValue" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/> - <fillField stepKey="fillInValueTitle" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption.title}}" /> - <fillField stepKey="fillInValuePrice" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption.price}}" /> + <fillField stepKey="fillInValueTitle" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption.title}}"/> + <fillField stepKey="fillInValuePrice" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption.price}}"/> - <click stepKey="clickAddValue2" selector="{{AdminProductCustomizableOptionsSection.addValue}}" /> + <click stepKey="clickAddValue2" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/> - <fillField stepKey="fillInValueTitle2" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption2.title}}" /> - <fillField stepKey="fillInValuePrice2" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption2.price}}" /> + <fillField stepKey="fillInValueTitle2" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption2.title}}"/> + <fillField stepKey="fillInValuePrice2" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption2.price}}"/> <!-- close the custom option dropdown --> - <click stepKey="closeCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}" /> + <click stepKey="closeCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}"/> </actionGroup> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml index 31a6ceaf2ac7c..2abc557d44d96 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductOptionData.xml @@ -27,7 +27,6 @@ <data key="price">20</data> <data key="price_type">fixed</data> <data key="max_characters">0</data> - <data key="expected_value">153.00</data> <!-- tied to this price and ProductOptionField --> </entity> <entity name="ProductOptionArea" type="product_option"> <var key="product_sku" entityType="product" entityKey="sku" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml index 5b70374b92e7c..37f2847e985ac 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml @@ -8,15 +8,15 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="SimpleProductTwoCustomOptions"> + <test name="SimpleProductTwoCustomOptionsTest"> <annotations> - <features value="CustomOptions" /> + <features value="Catalog"/> <stories value="Create simple product with two custom options" /> <title value="Admin should be able to create simple product with two custom options"/> <description value="Admin should be able to create simple product with two custom options"/> <severity value="AVERAGE"/> <testCaseId value="MC-248"/> - <group value="Levi"/> + <group value="Catalog"/> </annotations> <before> <!-- log in as admin --> @@ -43,44 +43,44 @@ <!-- Create a custom option with 2 values --> <actionGroup ref="CreateCustomRadioOptions" stepKey="createCustomOption1"> - <argument name="categoryName" value="ProductOptionRadiobutton.title"/> + <argument name="customOptionName" value="ProductOptionRadiobutton.title"/> <argument name="productOption" value="ProductOptionField"/> <argument name="productOption2" value="ProductOptionField2"/> </actionGroup> <!-- Create another custom option with 2 values --> <actionGroup ref="CreateCustomRadioOptions" stepKey="createCustomOption2"> - <argument name="categoryName" value="ProductOptionRadiobutton.title"/> + <argument name="customOptionName" value="ProductOptionRadiobutton.title"/> <argument name="productOption" value="ProductOptionField"/> <argument name="productOption2" value="ProductOptionField2"/> </actionGroup> <!-- Save the product --> - <click stepKey="saveProduct" selector="{{AdminProductFormActionSection.saveButton}}" /> - <waitForPageLoad stepKey="waitForProductSaved" /> + <click stepKey="saveProduct" selector="{{AdminProductFormActionSection.saveButton}}"/> + <waitForPageLoad stepKey="waitForProductSaved"/> <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccess"/> <!-- navigate to the created product page --> - <amOnPage url="/{{SimpleProduct3.name}}.html" stepKey="goToCreatedProduct" /> - <waitForPageLoad stepKey="waitForProductPageLoad" /> + <amOnPage url="/{{SimpleProduct3.name}}.html" stepKey="goToCreatedProduct"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> <!-- Check to make sure all of the created names are there --> - <see stepKey="assertNameInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField.title}}" /> - <see stepKey="assertNameInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField.title}}" /> - <see stepKey="assertSecondNameInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField2.title}}" /> - <see stepKey="assertSecondNameInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField2.title}}" /> + <see stepKey="assertNameInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField.title}}"/> + <see stepKey="assertNameInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField.title}}"/> + <see stepKey="assertSecondNameInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField2.title}}"/> + <see stepKey="assertSecondNameInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField2.title}}"/> <!-- Check to see that all of the created prices are there --> - <see stepKey="assertPriceInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField.price}}" /> - <see stepKey="assertPriceInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField.price}}" /> - <see stepKey="assertSecondPriceInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField2.price}}" /> - <see stepKey="assertSecondPriceInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField2.price}}" /> + <see stepKey="assertPriceInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField.price}}"/> + <see stepKey="assertPriceInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField.price}}"/> + <see stepKey="assertSecondPriceInFirstOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('1')}}" userInput="{{ProductOptionField2.price}}"/> + <see stepKey="assertSecondPriceInSecondOption" selector="{{StorefrontProductInfoMainSection.nthCustomOption('2')}}" userInput="{{ProductOptionField2.price}}"/> <!-- select two of the radio buttons --> - <click stepKey="selectFirstCustomOption" selector="{{StorefrontProductInfoMainSection.nthCustomOptionInput('1','2')}}" /> - <click stepKey="selectSecondCustomOption" selector="{{StorefrontProductInfoMainSection.nthCustomOptionInput('2','1')}}" /> + <click stepKey="selectFirstCustomOption" selector="{{StorefrontProductInfoMainSection.nthCustomOptionInput('1','2')}}"/> + <click stepKey="selectSecondCustomOption" selector="{{StorefrontProductInfoMainSection.nthCustomOptionInput('2','1')}}"/> <!-- Check that the price has actually changed --> - <see stepKey="assertPriceHasChanged" selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="{{ProductOptionField2.expected_value}}" /> + <see stepKey="assertPriceHasChanged" selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="153.00"/> </test> </tests> From 199200c97db7529320b66d17bb17feabfeffee8c Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Thu, 7 Jun 2018 15:56:28 -0500 Subject: [PATCH 084/133] MQE-1048: add non-tests codes from branch with blocked tests --- .../AdminAddDefaultVideoBundleProductTest.xml | 65 ---- ...minRemoveDefaultVideoBundleProductTest.xml | 65 ---- .../AdvanceCatalogSearchBundleProductTest.xml | 210 ------------ ...AdminAddDefaultVideoVirtualProductTest.xml | 34 -- ...inRemoveDefaultVideoVirtualProductTest.xml | 34 -- ...AdvanceCatalogSearchVirtualProductTest.xml | 81 ----- .../AdvanceCatalogSearchConfigurableTest.xml | 307 ------------------ ...AddDefaultVideoDownloadableProductTest.xml | 49 --- ...oveDefaultVideoDownloadableProductTest.xml | 49 --- ...ceCatalogSearchDownloadableProductTest.xml | 111 ------- ...AdminAddDefaultVideoGroupedProductTest.xml | 60 ---- ...inRemoveDefaultVideoGroupedProductTest.xml | 60 ---- ...AdvanceCatalogSearchGroupedProductTest.xml | 170 ---------- 13 files changed, 1295 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoVirtualProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoVirtualProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml deleted file mode 100644 index 516f47ef8ac56..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminAddDefaultVideoBundleProductTest.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoBundleProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> - <annotations> - <features value="Bundle"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default video for a Bundle Product"/> - <description value="Admin should be able to add default video for a Bundle Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-110"/> - <group value="Bundle"/> - </annotations> - <before> - <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> - <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> - </before> - <after> - <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> - <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> - </after> - - <!-- Create a bundle product --> - <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> - <argument name="product" value="BundleProduct"/> - </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillMainProductForm" after="goToCreateProductPage"> - <argument name="product" value="BundleProduct"/> - </actionGroup> - - <!-- Add two bundle items --> - <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="openBundleSection" after="addProductVideo"/> - <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption" after="openBundleSection"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleTitle" after="clickAddOption"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillBundleTitle" after="waitForBundleTitle"/> - <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectOptionBundleTitle" after="fillBundleTitle"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProducts" after="selectOptionBundleTitle"/> - <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProducts" after="waitForAddProducts"/> - <waitForPageLoad stepKey="waitForPageLoad" after="clickAddProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForPageLoad"> - <argument name="product" value="$$simpleProduct1$$"/> - </actionGroup> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption1" after="filterProductGridBySku1"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2" after="checkOption1"> - <argument name="product" value="$$simpleProduct2$$"/> - </actionGroup> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> - <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="addProducts" after="checkOption2"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty1" after="addProducts"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty2" before="saveProductForm"/> - - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="BundleProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml deleted file mode 100644 index 51fa38ce421c8..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdminRemoveDefaultVideoBundleProductTest.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoBundleProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> - <annotations> - <features value="Bundle"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default video from a Bundle Product"/> - <description value="Admin should be able to remove default video from a Bundle Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-205"/> - <group value="Bundle"/> - </annotations> - <before> - <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> - <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> - </before> - <after> - <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> - <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> - </after> - - <!-- Create a bundle product --> - <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage" after="waitForProductIndexPageLoad"> - <argument name="product" value="BundleProduct"/> - </actionGroup> - <actionGroup ref="fillProductNameAndSkuInProductForm" stepKey="fillMainProductForm" after="goToCreateProductPage"> - <argument name="product" value="BundleProduct"/> - </actionGroup> - - <!-- Add two bundle items --> - <conditionalClick selector="{{AdminProductFormBundleSection.bundleItemsToggle}}" dependentSelector="{{AdminProductFormBundleSection.bundleItemsToggle}}" visible="false" stepKey="openBundleSection" after="addProductVideo"/> - <click selector="{{AdminProductFormBundleSection.addOption}}" stepKey="clickAddOption" after="openBundleSection"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" stepKey="waitForBundleTitle" after="clickAddOption"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXTitle('0')}}" userInput="{{BundleProduct.optionTitle1}}" stepKey="fillBundleTitle" after="waitForBundleTitle"/> - <selectOption selector="{{AdminProductFormBundleSection.bundleOptionXInputType('0')}}" userInput="{{BundleProduct.optionInputType1}}" stepKey="selectOptionBundleTitle" after="fillBundleTitle"/> - <waitForElementVisible selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="waitForAddProducts" after="selectOptionBundleTitle"/> - <click selector="{{AdminProductFormBundleSection.addProductsToOption}}" stepKey="clickAddProducts" after="waitForAddProducts"/> - <waitForPageLoad stepKey="waitForPageLoad" after="clickAddProducts"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForPageLoad"> - <argument name="product" value="$$simpleProduct1$$"/> - </actionGroup> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption1" after="filterProductGridBySku1"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2" after="checkOption1"> - <argument name="product" value="$$simpleProduct2$$"/> - </actionGroup> - <checkOption selector="{{AdminAddProductsToOptionPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> - <click selector="{{AdminAddProductsToOptionPanel.addSelectedProducts}}" stepKey="addProducts" after="checkOption2"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '0')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty1" after="addProducts"/> - <fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYQuantity('0', '1')}}" userInput="{{BundleProduct.defaultQuantity}}" stepKey="fillQty2" before="saveProductForm"/> - - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="BundleProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml deleted file mode 100644 index 44ae4b7476aeb..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Bundle/Test/AdvanceCatalogSearchBundleProductTest.xml +++ /dev/null @@ -1,210 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchBundleByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="Bundle"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product name"/> - <description value="Guest customer should be able to advance search Bundle product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-139"/> - <group value="Bundle"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiBundleProduct" stepKey="product"/> - <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="product"/> - </createData> - <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="product"/> - </getData> - <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple2"/> - </createData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchBundleBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> - <annotations> - <features value="Bundle"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product sku"/> - <description value="Guest customer should be able to advance search Bundle product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-143"/> - <group value="Bundle"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiBundleProduct" stepKey="product"/> - <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="product"/> - </createData> - <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="product"/> - </getData> - <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple2"/> - </createData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchBundleByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> - <annotations> - <features value="Bundle"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product description"/> - <description value="Guest customer should be able to advance search Bundle product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-242"/> - <group value="Bundle"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiBundleProduct" stepKey="product"/> - <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="product"/> - </createData> - <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="product"/> - </getData> - <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple2"/> - </createData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchBundleByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> - <annotations> - <features value="Bundle"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product short description"/> - <description value="Guest customer should be able to advance search Bundle product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-250"/> - <group value="Bundle"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiBundleProduct" stepKey="product"/> - <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="product"/> - </createData> - <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="product"/> - </getData> - <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple2"/> - </createData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchBundleByPriceTest" extends="AdvanceCatalogSearchSimpleProductByPriceTest"> - <annotations> - <features value="Bundle"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Bundle product with product price"/> - <description value="Guest customer should be able to advance search Bundle product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-251"/> - <group value="Bundle"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiBundleProduct" stepKey="product"/> - <createData entity="DropdownBundleOption" stepKey="bundleOption"> - <requiredEntity createDataKey="product"/> - </createData> - <getData entity="AllBundleOptions" index="0" stepKey="getBundleOption"> - <requiredEntity createDataKey="product"/> - </getData> - <createData entity="ApiBundleLink" stepKey="createBundleLink1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <createData entity="ApiBundleLink" stepKey="createBundleLink2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="getBundleOption"/> - <requiredEntity createDataKey="simple2"/> - </createData> - <getData entity="GetProduct" stepKey="arg1"> - <requiredEntity createDataKey="product"/> - </getData> - <getData entity="GetProduct" stepKey="arg2"> - <requiredEntity createDataKey="simple1"/> - </getData> - <getData entity="GetProduct" stepKey="arg3"> - <requiredEntity createDataKey="simple2"/> - </getData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoVirtualProductTest.xml deleted file mode 100644 index f48c352c5290a..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoVirtualProductTest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoVirtualProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default product video for a Virtual Product"/> - <description value="Admin should be able to add default product video for a Virtual Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-109"/> - <group value="Catalog"/> - </annotations> - - <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> - - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="defaultVirtualProduct"/> - </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> - <argument name="product" value="defaultVirtualProduct"/> - </actionGroup> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="defaultVirtualProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoVirtualProductTest.xml deleted file mode 100644 index e6d3978cad7bb..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoVirtualProductTest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoVirtualProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default product video from a Virtual Product"/> - <description value="Admin should be able to remove default product video from a Virtual Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-204"/> - <group value="Catalog"/> - </annotations> - - <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> - - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="defaultVirtualProduct"/> - </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> - <argument name="product" value="defaultVirtualProduct"/> - </actionGroup> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="defaultVirtualProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml deleted file mode 100644 index 0eb8f5668751a..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdvanceCatalogSearchVirtualProductTest.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchVirtualProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="Catalog"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product name"/> - <description value="Guest customer should be able to advance search virtual product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-137"/> - <group value="Catalog"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> - </before> - </test> - <test name="AdvanceCatalogSearchVirtualProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> - <annotations> - <features value="Catalog"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product sku"/> - <description value="Guest customer should be able to advance search virtual product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-162"/> - <group value="Catalog"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> - </before> - </test> - <test name="AdvanceCatalogSearchVirtualProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> - <annotations> - <features value="Catalog"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product description"/> - <description value="Guest customer should be able to advance search virtual product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-163"/> - <group value="Catalog"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> - </before> - </test> - <test name="AdvanceCatalogSearchVirtualProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> - <annotations> - <features value="Catalog"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product short description"/> - <description value="Guest customer should be able to advance search virtual product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-164"/> - <group value="Catalog"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> - </before> - </test> - <test name="AdvanceCatalogSearchVirtualProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByPriceTest"> - <annotations> - <features value="Catalog"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search virtual product with product price"/> - <description value="Guest customer should be able to advance search virtual product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-165"/> - <group value="Catalog"/> - </annotations> - <before> - <createData entity="ApiVirtualProductWithDescription" stepKey="product"/> - </before> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml deleted file mode 100644 index 454f9f5f29a7a..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdvanceCatalogSearchConfigurableTest.xml +++ /dev/null @@ -1,307 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchConfigurableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="ConfigurableProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search configurable product with product name"/> - <description value="Guest customer should be able to advance search configurable product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-138"/> - <group value="ConfigurableProduct"/> - </annotations> - <before> - <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> - - <createData entity="SimpleProduct" stepKey="simple1Handle" before="simple2Handle"> - <requiredEntity createDataKey="categoryHandle"/> - </createData> - - <createData entity="SimpleProduct" stepKey="simple2Handle" before="product"> - <requiredEntity createDataKey="categoryHandle"/> - </createData> - - <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> - <createData entity="ApiConfigurableProductWithDescription" stepKey="product"/> - - <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> - - <createData entity="productAttributeOption1" stepKey="productAttributeOption1Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - <createData entity="productAttributeOption2" stepKey="productAttributeOption2Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - - <createData entity="AddToDefaultSet" stepKey="addToAttributeSetHandle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - - <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption1Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </getData> - <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getAttributeOption2Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </getData> - - <createData entity="SimpleOne" stepKey="childProductHandle1"> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption1Handle"/> - </createData> - <createData entity="SimpleOne" stepKey="childProductHandle2"> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption2Handle"/> - </createData> - - <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption1Handle"/> - <requiredEntity createDataKey="getAttributeOption2Handle"/> - </createData> - - <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="childProductHandle1"/> - </createData> - <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="childProductHandle2"/> - </createData> - </before> - <after> - <deleteData createDataKey="simple1Handle" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2Handle" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchConfigurableBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> - <annotations> - <features value="ConfigurableProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search configurable product with product sku"/> - <description value="Guest customer should be able to advance search configurable product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-144"/> - <group value="ConfigurableProduct"/> - </annotations> - <before> - <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> - - <createData entity="SimpleProduct" stepKey="simple1Handle" before="simple2Handle"> - <requiredEntity createDataKey="categoryHandle"/> - </createData> - - <createData entity="SimpleProduct" stepKey="simple2Handle" before="product"> - <requiredEntity createDataKey="categoryHandle"/> - </createData> - - <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> - <createData entity="ApiConfigurableProductWithDescription" stepKey="product"/> - - <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> - - <createData entity="productAttributeOption1" stepKey="productAttributeOption1Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - <createData entity="productAttributeOption2" stepKey="productAttributeOption2Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - - <createData entity="AddToDefaultSet" stepKey="addToAttributeSetHandle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - - <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption1Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </getData> - <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getAttributeOption2Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </getData> - - <createData entity="SimpleOne" stepKey="childProductHandle1"> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption1Handle"/> - </createData> - <createData entity="SimpleOne" stepKey="childProductHandle2"> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption2Handle"/> - </createData> - - <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption1Handle"/> - <requiredEntity createDataKey="getAttributeOption2Handle"/> - </createData> - - <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="childProductHandle1"/> - </createData> - <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="childProductHandle2"/> - </createData> - </before> - <after> - <deleteData createDataKey="simple1Handle" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2Handle" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchConfigurableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> - <annotations> - <features value="ConfigurableProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search configurable product with product description"/> - <description value="Guest customer should be able to advance search configurable product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-237"/> - <group value="ConfigurableProduct"/> - </annotations> - <before> - <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> - - <createData entity="SimpleProduct" stepKey="simple1Handle" before="simple2Handle"> - <requiredEntity createDataKey="categoryHandle"/> - </createData> - - <createData entity="SimpleProduct" stepKey="simple2Handle" before="product"> - <requiredEntity createDataKey="categoryHandle"/> - </createData> - - <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> - <createData entity="ApiConfigurableProductWithDescription" stepKey="product"/> - - <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> - - <createData entity="productAttributeOption1" stepKey="productAttributeOption1Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - <createData entity="productAttributeOption2" stepKey="productAttributeOption2Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - - <createData entity="AddToDefaultSet" stepKey="addToAttributeSetHandle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - - <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption1Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </getData> - <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getAttributeOption2Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </getData> - - <createData entity="SimpleOne" stepKey="childProductHandle1"> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption1Handle"/> - </createData> - <createData entity="SimpleOne" stepKey="childProductHandle2"> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption2Handle"/> - </createData> - - <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption1Handle"/> - <requiredEntity createDataKey="getAttributeOption2Handle"/> - </createData> - - <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="childProductHandle1"/> - </createData> - <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="childProductHandle2"/> - </createData> - </before> - <after> - <deleteData createDataKey="simple1Handle" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2Handle" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchConfigurableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> - <annotations> - <features value="ConfigurableProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search configurable product with product short description"/> - <description value="Guest customer should be able to advance search configurable product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-240"/> - <group value="ConfigurableProduct"/> - </annotations> - <before> - <createData entity="SimpleSubCategory" stepKey="categoryHandle" before="simple1Handle"/> - - <createData entity="SimpleProduct" stepKey="simple1Handle" before="simple2Handle"> - <requiredEntity createDataKey="categoryHandle"/> - </createData> - - <createData entity="SimpleProduct" stepKey="simple2Handle" before="product"> - <requiredEntity createDataKey="categoryHandle"/> - </createData> - - <!-- TODO: Move configurable product creation to an actionGroup when MQE-697 is fixed --> - <createData entity="ApiConfigurableProductWithDescription" stepKey="product"/> - - <createData entity="productDropDownAttribute" stepKey="productAttributeHandle"/> - - <createData entity="productAttributeOption1" stepKey="productAttributeOption1Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - <createData entity="productAttributeOption2" stepKey="productAttributeOption2Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - - <createData entity="AddToDefaultSet" stepKey="addToAttributeSetHandle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </createData> - - <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getAttributeOption1Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </getData> - <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getAttributeOption2Handle"> - <requiredEntity createDataKey="productAttributeHandle"/> - </getData> - - <createData entity="SimpleOne" stepKey="childProductHandle1"> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption1Handle"/> - </createData> - <createData entity="SimpleOne" stepKey="childProductHandle2"> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption2Handle"/> - </createData> - - <createData entity="ConfigurableProductTwoOptions" stepKey="configProductOptionHandle"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="productAttributeHandle"/> - <requiredEntity createDataKey="getAttributeOption1Handle"/> - <requiredEntity createDataKey="getAttributeOption2Handle"/> - </createData> - - <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle1"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="childProductHandle1"/> - </createData> - <createData entity="ConfigurableProductAddChild" stepKey="configProductHandle2"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="childProductHandle2"/> - </createData> - </before> - <after> - <deleteData createDataKey="simple1Handle" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2Handle" stepKey="deleteSimple2" before="delete"/> - </after> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml deleted file mode 100644 index 63ed252360f00..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminAddDefaultVideoDownloadableProductTest.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoDownloadableProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> - <annotations> - <features value="Downloadable"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default video for a Downloadable Product"/> - <description value="Admin should be able to add default video for a Downloadable Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-114"/> - <group value="Downloadable"/> - </annotations> - - <!-- Create a downloadable product --> - <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="DownloadableProduct"/> - </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> - <argument name="product" value="DownloadableProduct"/> - </actionGroup> - - <!-- Add downloadable links --> - <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="addProductVideo"/> - <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkOptionIsDownloadable" after="openDownloadableSection"/> - <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillLinkTitle" after="checkOptionIsDownloadable"/> - <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately" after="fillLinkTitle"/> - <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillSampleTitle" after="checkOptionPurchaseSeparately"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLinkWithMaxDownloads" after="fillSampleTitle"> - <argument name="link" value="downloadableLinkWithMaxDownloads"/> - </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableProductLink" before="saveProductForm"> - <argument name="link" value="downloadableLink"/> - </actionGroup> - - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="DownloadableProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml deleted file mode 100644 index 2210dd009318a..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdminRemoveDefaultVideoDownloadableProductTest.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoDownloadableProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> - <annotations> - <features value="Downloadable"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default video from a Downloadable Product"/> - <description value="Admin should be able to remove default video from a Downloadable Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-207"/> - <group value="Downloadable"/> - </annotations> - - <!-- Create a downloadable product --> - <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="DownloadableProduct"/> - </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> - <argument name="product" value="DownloadableProduct"/> - </actionGroup> - - <!-- Add downloadable links --> - <click selector="{{AdminProductDownloadableSection.sectionHeader}}" stepKey="openDownloadableSection" after="addProductVideo"/> - <checkOption selector="{{AdminProductDownloadableSection.isDownloadableProduct}}" stepKey="checkOptionIsDownloadable" after="openDownloadableSection"/> - <fillField userInput="{{downloadableData.link_title}}" selector="{{AdminProductDownloadableSection.linksTitleInput}}" stepKey="fillLinkTitle" after="checkOptionIsDownloadable"/> - <checkOption selector="{{AdminProductDownloadableSection.isLinksPurchasedSeparately}}" stepKey="checkOptionPurchaseSeparately" after="fillLinkTitle"/> - <fillField userInput="{{downloadableData.sample_title}}" selector="{{AdminProductDownloadableSection.samplesTitleInput}}" stepKey="fillSampleTitle" after="checkOptionPurchaseSeparately"/> - <actionGroup ref="addDownloadableProductLinkWithMaxDownloads" stepKey="addDownloadableProductLinkWithMaxDownloads" after="fillSampleTitle"> - <argument name="link" value="downloadableLinkWithMaxDownloads"/> - </actionGroup> - <actionGroup ref="addDownloadableProductLink" stepKey="addDownloadableProductLink" before="saveProductForm"> - <argument name="link" value="downloadableLink"/> - </actionGroup> - - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="DownloadableProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml deleted file mode 100644 index af5d20b075d12..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Downloadable/Test/AdvanceCatalogSearchDownloadableProductTest.xml +++ /dev/null @@ -1,111 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchDownloadableByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="Downloadable"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product name"/> - <description value="Guest customer should be able to advance search Downloadable product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-142"/> - <group value="Downloadable"/> - </annotations> - <before> - <createData entity="ApiDownloadableProduct" stepKey="product"/> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="product"/> - </createData> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="product"/> - </createData> - </before> - </test> - <test name="AdvanceCatalogSearchDownloadableBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> - <annotations> - <features value="Downloadable"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product sku"/> - <description value="Guest customer should be able to advance search Downloadable product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-252"/> - <group value="Downloadable"/> - </annotations> - <before> - <createData entity="ApiDownloadableProduct" stepKey="product"/> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="product"/> - </createData> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="product"/> - </createData> - </before> - </test> - <test name="AdvanceCatalogSearchDownloadableByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> - <annotations> - <features value="Downloadable"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product description"/> - <description value="Guest customer should be able to advance search Downloadable product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-243"/> - <group value="Downloadable"/> - </annotations> - <before> - <createData entity="ApiDownloadableProduct" stepKey="product"/> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="product"/> - </createData> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="product"/> - </createData> - </before> - </test> - <test name="AdvanceCatalogSearchDownloadableByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> - <annotations> - <features value="Downloadable"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product short description"/> - <description value="Guest customer should be able to advance search Downloadable product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-245"/> - <group value="Downloadable"/> - </annotations> - <before> - <createData entity="ApiDownloadableProduct" stepKey="product"/> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="product"/> - </createData> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="product"/> - </createData> - </before> - </test> - <test name="AdvanceCatalogSearchDownloadableByPriceTest" extends="AdvanceCatalogSearchSimpleProductByPriceTest"> - <annotations> - <features value="Downloadable"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Downloadable product with product price"/> - <description value="Guest customer should be able to advance search Downloadable product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-246"/> - <group value="Downloadable"/> - </annotations> - <before> - <createData entity="ApiDownloadableProduct" stepKey="product"/> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink1"> - <requiredEntity createDataKey="product"/> - </createData> - <createData entity="ApiDownloadableLink" stepKey="addDownloadableLink2"> - <requiredEntity createDataKey="product"/> - </createData> - </before> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml deleted file mode 100644 index d4c4655895051..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminAddDefaultVideoGroupedProductTest.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoGroupedProductTest" extends="AdminAddDefaultVideoSimpleProductTest"> - <annotations> - <features value="GroupedProduct"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default video for a Grouped Product"/> - <description value="Admin should be able to add default video for a Grouped Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-108"/> - <group value="GroupedProduct"/> - </annotations> - <before> - <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> - <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> - </before> - <after> - <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> - <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> - </after> - - <!-- Create a grouped product --> - <!-- Replacing steps in base AdminAddDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="GroupedProduct"/> - </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> - <argument name="product" value="GroupedProduct"/> - </actionGroup> - - <!-- Add two simple products to grouped product --> - <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollTo" after="addProductVideo"/> - <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductSection" after="scrollTo"/> - <click selector="body" stepKey="clickBody" after="openGroupedProductSection"/> - <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup" after="clickBody"/> - <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForFilter" after="clickAddProductsToGroup"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForFilter"> - <argument name="product" value="$$simpleProduct1$$"/> - </actionGroup> - <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption1" after="filterProductGridBySku1"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2" after="checkOption1"> - <argument name="product" value="$$simpleProduct2$$"/> - </actionGroup> - <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> - <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="addSelectedProducts" before="saveProductForm"/> - - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="GroupedProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml deleted file mode 100644 index 577fe9644a6fc..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdminRemoveDefaultVideoGroupedProductTest.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoGroupedProductTest" extends="AdminRemoveDefaultVideoSimpleProductTest"> - <annotations> - <features value="GroupedProduct"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default video from a Grouped Product"/> - <description value="Admin should be able to remove default video from a Grouped Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-203"/> - <group value="GroupedProduct"/> - </annotations> - <before> - <createData entity="SimpleProduct2" stepKey="simpleProduct1"/> - <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> - </before> - <after> - <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> - <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> - </after> - - <!-- Create a grouped product --> - <!-- Replacing steps in base AdminRemoveDefaultVideoSimpleProductTest --> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="GroupedProduct"/> - </actionGroup> - <actionGroup ref="fillGroupedProductForm" stepKey="fillMainProductForm"> - <argument name="product" value="GroupedProduct"/> - </actionGroup> - - <!-- Add two simple products to grouped product --> - <scrollTo selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" x="0" y="-100" stepKey="scrollTo" after="addProductVideo"/> - <conditionalClick selector="{{AdminProductFormGroupedProductsSection.toggleGroupedProduct}}" dependentSelector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" visible="false" stepKey="openGroupedProductSection" after="scrollTo"/> - <click selector="body" stepKey="clickBody" after="openGroupedProductSection"/> - <click selector="{{AdminProductFormGroupedProductsSection.addProductsToGroup}}" stepKey="clickAddProductsToGroup" after="clickBody"/> - <waitForElementVisible selector="{{AdminAddProductsToGroupPanel.filters}}" stepKey="waitForFilter" after="clickAddProductsToGroup"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku1" after="waitForFilter"> - <argument name="product" value="$$simpleProduct1$$"/> - </actionGroup> - <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption1" after="filterProductGridBySku1"/> - <actionGroup ref="filterProductGridBySku" stepKey="filterProductGridBySku2" after="checkOption1"> - <argument name="product" value="$$simpleProduct2$$"/> - </actionGroup> - <checkOption selector="{{AdminAddProductsToGroupPanel.firstCheckbox}}" stepKey="checkOption2" after="filterProductGridBySku2"/> - <click selector="{{AdminAddProductsToGroupPanel.addSelectedProducts}}" stepKey="addSelectedProducts" before="saveProductForm"/> - - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductNameAndSkuInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="GroupedProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml deleted file mode 100644 index 0fd52ac4a65a4..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/GroupedProduct/Test/AdvanceCatalogSearchGroupedProductTest.xml +++ /dev/null @@ -1,170 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdvanceCatalogSearchGroupedProductByNameTest" extends="AdvanceCatalogSearchSimpleProductByNameTest"> - <annotations> - <features value="GroupedProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product name"/> - <description value="Guest customer should be able to advance search Grouped product with product name"/> - <severity value="MAJOR"/> - <testCaseId value="MC-141"/> - <group value="GroupedProduct"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiGroupedProduct" stepKey="product"/> - <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple2"/> - </updateData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchGroupedProductBySkuTest" extends="AdvanceCatalogSearchSimpleProductBySkuTest"> - <annotations> - <features value="GroupedProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product sku"/> - <description value="Guest customer should be able to advance search Grouped product with product sku"/> - <severity value="MAJOR"/> - <testCaseId value="MC-146"/> - <group value="GroupedProduct"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiGroupedProduct" stepKey="product"/> - <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple2"/> - </updateData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchGroupedProductByDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByDescriptionTest"> - <annotations> - <features value="GroupedProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product description"/> - <description value="Guest customer should be able to advance search Grouped product with product description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-282"/> - <group value="GroupedProduct"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiGroupedProduct" stepKey="product"/> - <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple2"/> - </updateData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchGroupedProductByShortDescriptionTest" extends="AdvanceCatalogSearchSimpleProductByShortDescriptionTest"> - <annotations> - <features value="GroupedProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product short description"/> - <description value="Guest customer should be able to advance search Grouped product with product short description"/> - <severity value="MAJOR"/> - <testCaseId value="MC-283"/> - <group value="GroupedProduct"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiGroupedProduct" stepKey="product"/> - <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple2"/> - </updateData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> - <test name="AdvanceCatalogSearchGroupedProductByPriceTest" extends="AdvanceCatalogSearchSimpleProductByPriceTest"> - <annotations> - <features value="GroupedProduct"/> - <stories value="Advanced Catalog Product Search for all product types"/> - <title value="Guest customer should be able to advance search Grouped product with product price"/> - <description value="Guest customer should be able to advance search Grouped product with product price"/> - <severity value="MAJOR"/> - <testCaseId value="MC-284"/> - <group value="GroupedProduct"/> - </annotations> - <before> - <createData entity="ApiProductWithDescription" stepKey="simple1" before="simple2"/> - <createData entity="ApiProductWithDescription" stepKey="simple2" before="product"/> - <createData entity="ApiGroupedProduct" stepKey="product"/> - <createData entity="OneSimpleProductLink" stepKey="addProductOne"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple1"/> - </createData> - <updateData entity="OneMoreSimpleProductLink" createDataKey="addProductOne" stepKey="addProductTwo"> - <requiredEntity createDataKey="product"/> - <requiredEntity createDataKey="simple2"/> - </updateData> - <getData entity="GetProduct3" stepKey="arg1"> - <requiredEntity createDataKey="product"/> - </getData> - <getData entity="GetProduct" stepKey="arg2"> - <requiredEntity createDataKey="simple1"/> - </getData> - <getData entity="GetProduct" stepKey="arg3"> - <requiredEntity createDataKey="simple2"/> - </getData> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - </before> - <after> - <deleteData createDataKey="simple1" stepKey="deleteSimple1" before="deleteSimple2"/> - <deleteData createDataKey="simple2" stepKey="deleteSimple2" before="delete"/> - </after> - </test> -</tests> From f93c91664f662852880c1c2e4ff6c7070c629f82 Mon Sep 17 00:00:00 2001 From: OlgaVasyltsun <olga.vasyltsun@transoftgroup.com> Date: Fri, 8 Jun 2018 14:16:04 +0300 Subject: [PATCH 085/133] MAGETWO-92137: Refreshing page deletes shipping address on guest checkout if module-persistent is enabled --- .../Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml index 3e8411629dd6f..3fb6e99ed6730 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Page/GuestCheckoutReviewAndPaymentsPage.xml @@ -8,7 +8,6 @@ <pages 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="GuestCheckoutReviewAndPaymentsPage" url="/checkout/#payment" area="storefront" module="Magento_Checkout"> - <section name="PaymentMethodSection"/> - <section name="ShipToSection"/> + <section name="CheckoutPaymentSection"/> </page> </pages> From b72f5c358062d92a9893697be85e1961d8705719 Mon Sep 17 00:00:00 2001 From: DianaRusin <rusind95@gmail.com> Date: Fri, 8 Jun 2018 15:07:24 +0300 Subject: [PATCH 086/133] MAGETWO-65458: Cart Rules are not excluding Bundle Products --- app/code/Magento/Bundle/composer.json | 2 +- .../Magento/SalesRule/Model/RulesApplier.php | 2 +- .../Quote/ChildrenValidationLocatorTest.php | 104 ++++++++++++++++++ .../SalesRule/_files/rules_sku_exclude.php | 34 +++--- 4 files changed, 123 insertions(+), 19 deletions(-) create mode 100644 app/code/Magento/SalesRule/Test/Unit/Model/Quote/ChildrenValidationLocatorTest.php diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index 60b988372a316..84c9a97698b71 100644 --- a/app/code/Magento/Bundle/composer.json +++ b/app/code/Magento/Bundle/composer.json @@ -26,7 +26,7 @@ "suggest": { "magento/module-webapi": "*", "magento/module-bundle-sample-data": "*", - "magento/module-sales-rule": "101.0.*" + "magento/module-sales-rule": "*" }, "type": "magento2-module", "license": [ diff --git a/app/code/Magento/SalesRule/Model/RulesApplier.php b/app/code/Magento/SalesRule/Model/RulesApplier.php index 69467ca7cd0ea..f771a4f1e3892 100644 --- a/app/code/Magento/SalesRule/Model/RulesApplier.php +++ b/app/code/Magento/SalesRule/Model/RulesApplier.php @@ -42,7 +42,7 @@ class RulesApplier * @param \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\SalesRule\Model\Utility $utility - * @param ChildrenValidationLocator $childrenValidationLocator + * @param ChildrenValidationLocator|null $childrenValidationLocator */ public function __construct( \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory, diff --git a/app/code/Magento/SalesRule/Test/Unit/Model/Quote/ChildrenValidationLocatorTest.php b/app/code/Magento/SalesRule/Test/Unit/Model/Quote/ChildrenValidationLocatorTest.php new file mode 100644 index 0000000000000..abb8d791d74c4 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Unit/Model/Quote/ChildrenValidationLocatorTest.php @@ -0,0 +1,104 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\SalesRule\Test\Unit\Model\Quote; + +use Magento\SalesRule\Model\Quote\ChildrenValidationLocator; +use Magento\Quote\Model\Quote\Item\AbstractItem as QuoteItem; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Catalog\Model\Product; + +/** + * Test for Magento\SalesRule\Model\Quote\ChildrenValidationLocator + */ +class ChildrenValidationLocatorTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var array + */ + private $productTypeChildrenValidationMap; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var ChildrenValidationLocator + */ + private $model; + + /** + * @var QuoteItem|\PHPUnit_Framework_MockObject_MockObject + */ + private $quoteItemMock; + + /** + * @var Product|\PHPUnit_Framework_MockObject_MockObject + */ + private $productMock; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + + $this->productTypeChildrenValidationMap = [ + 'type1' => true, + 'type2' => false, + ]; + + $this->quoteItemMock = $this->getMockBuilder(QuoteItem::class) + ->disableOriginalConstructor() + ->setMethods(['getProduct']) + ->getMockForAbstractClass(); + + $this->productMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->setMethods(['getTypeId']) + ->getMock(); + + $this->model = $this->objectManager->getObject( + ChildrenValidationLocator::class, + [ + 'productTypeChildrenValidationMap' => $this->productTypeChildrenValidationMap, + ] + ); + } + + /** + * @dataProvider productTypeDataProvider + * @param string $type + * @param bool $expected + * + * @return void + */ + public function testIsChildrenValidationRequired(string $type, bool $expected): void + { + $this->quoteItemMock->expects($this->once()) + ->method('getProduct') + ->willReturn($this->productMock); + + $this->productMock->expects($this->once()) + ->method('getTypeId') + ->willReturn($type); + + $this->assertEquals($this->model->isChildrenValidationRequired($this->quoteItemMock), $expected); + } + + /** + * @return array + */ + public function productTypeDataProvider(): array + { + return [ + ['type1', true], + ['type2', false], + ['type3', true], + ]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude.php index 9c2b4c289e4ae..9d88fe48ae111 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/rules_sku_exclude.php @@ -35,7 +35,7 @@ 'website_ids' => [ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( \Magento\Store\Model\StoreManagerInterface::class - )->getWebsite()->getId() + )->getWebsite()->getId(), ], ] ); @@ -49,24 +49,24 @@ 'aggregator' => 'all', 'conditions' => [ - [ - 'type' => \Magento\SalesRule\Model\Rule\Condition\Product\Found::class, - 'attribute' => null, - 'operator' => null, - 'value' => '1', - 'is_value_processed' => null, - 'aggregator' => 'all', - 'conditions' => + [ + 'type' => \Magento\SalesRule\Model\Rule\Condition\Product\Found::class, + 'attribute' => null, + 'operator' => null, + 'value' => '1', + 'is_value_processed' => null, + 'aggregator' => 'all', + 'conditions' => + [ [ - [ - 'type' => \Magento\SalesRule\Model\Rule\Condition\Product::class, - 'attribute' => 'sku', - 'operator' => '!=', - 'value' => 'product-bundle', - 'is_value_processed' => false, - ], + 'type' => \Magento\SalesRule\Model\Rule\Condition\Product::class, + 'attribute' => 'sku', + 'operator' => '!=', + 'value' => 'product-bundle', + 'is_value_processed' => false, ], - ], + ], + ], ], ]); From b0720bfc8adf64604c3bc0462abdc153afb616a4 Mon Sep 17 00:00:00 2001 From: Ji Lu <jilu1@magento.com> Date: Fri, 8 Jun 2018 10:08:32 -0500 Subject: [PATCH 087/133] MQE-1048: add non-tests codes from branch with blocked tests --- .../AdminAddDefaultVideoSimpleProductTest.xml | 46 ----------------- ...minRemoveDefaultVideoSimpleProductTest.xml | 49 ------------------- .../AdminAddDefaultVideoSimpleProductTest.xml | 33 ------------- ...minRemoveDefaultVideoSimpleProductTest.xml | 36 -------------- 4 files changed, 164 deletions(-) delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoSimpleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoSimpleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml delete mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoSimpleProductTest.xml deleted file mode 100644 index c0bc3bfc127f3..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddDefaultVideoSimpleProductTest.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoSimpleProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to add default product video for a Simple Product"/> - <description value="Admin should be able to add default product video for a Simple Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-111"/> - <group value="Catalog"/> - </annotations> - <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - </before> - <after> - <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> - </after> - - <!-- Create product --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> - <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> - - <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> - - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoSimpleProductTest.xml deleted file mode 100644 index 6ec562322824d..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminRemoveDefaultVideoSimpleProductTest.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoSimpleProductTest"> - <annotations> - <features value="Catalog"/> - <stories value="Add/remove images and videos for all product types and category"/> - <title value="Admin should be able to remove default product video from a Simple Product"/> - <description value="Admin should be able to remove default product video from a Simple Product"/> - <severity value="MAJOR"/> - <testCaseId value="MC-206"/> - <group value="Catalog"/> - </annotations> - <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - </before> - <after> - <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> - </after> - - <!-- Create product --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="adminProductIndexPageAdd"/> - <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> - <actionGroup ref="goToCreateProductPage" stepKey="goToCreateProductPage"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> - <actionGroup ref="fillMainProductFormNoWeight" stepKey="fillMainProductForm"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> - - <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductForm"/> - - <!-- Save product --> - <actionGroup ref="saveProductForm" stepKey="saveProductFormAfterRemove"/> - - <!-- Assert product in storefront product page --> - <actionGroup ref="AssertProductInStorefrontProductPage" stepKey="AssertProductInStorefrontProductPage"> - <argument name="product" value="ApiSimpleProduct"/> - </actionGroup> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml deleted file mode 100644 index bd7cc0cdf5b4a..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminAddDefaultVideoSimpleProductTest.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminAddDefaultVideoSimpleProductTest"> - <annotations> - <group value="ProductVideo"/> - </annotations> - <before> - <!-- Set product video Youtube api key configuration --> - <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> - </before> - <after> - <!-- Set product video configuration to default --> - <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" before="amOnLogoutPage"/> - </after> - - <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="fillMainProductForm"/> - - <!-- Assert product video in admin product form --> - <actionGroup ref="assertProductVideoAdminProductPage" stepKey="assertProductVideoAdminProductPage" after="saveProductForm"/> - - <!-- Assert product video in storefront product page --> - <actionGroup ref="assertProductVideoStorefrontProductPage" stepKey="assertProductVideoStorefrontProductPage" after="AssertProductInStorefrontProductPage"/> - </test> -</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml deleted file mode 100644 index f5a7886fed45c..0000000000000 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ProductVideo/Test/AdminRemoveDefaultVideoSimpleProductTest.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminRemoveDefaultVideoSimpleProductTest"> - <annotations> - <group value="ProductVideo"/> - </annotations> - <before> - <!-- Set product video Youtube api key configuration --> - <createData entity="ProductVideoYoutubeApiKeyConfig" stepKey="setStoreConfig" after="loginAsAdmin"/> - </before> - <after> - <!-- Set product video configuration to default --> - <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" before="amOnLogoutPage"/> - </after> - - <!-- Add product video --> - <actionGroup ref="addProductVideo" stepKey="addProductVideo" after="fillMainProductForm"/> - - <!-- Remove product video --> - <actionGroup ref="removeProductVideo" stepKey="removeProductVideo" after="saveProductForm"/> - - <!-- Assert product video not in admin product form --> - <actionGroup ref="assertProductVideoNotInAdminProductPage" stepKey="assertProductVideoNotInAdminProductPage" after="saveProductFormAfterRemove"/> - - <!-- Assert product video not in storefront product page --> - <actionGroup ref="assertProductVideoNotInStorefrontProductPage" stepKey="assertProductVideoNotInStorefrontProductPage" after="AssertProductInStorefrontProductPage"/> - </test> -</tests> From 445bb79f8486251cf91d3646780a5d6cb957cc4b Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 8 Jun 2018 10:10:19 -0500 Subject: [PATCH 088/133] MC-234: Admin should be able to create category from the product page - Fixed errors causing test failure --- ...AdminCreateCategoryFromProductPageTest.xml | 40 ++++++++++-------- ...ConfigurableProductUpdateAttributeTest.xml | 42 ++++++++++++++----- 2 files changed, 53 insertions(+), 29 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml index a5fe983aa5ad0..a866b9bd9937f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml @@ -8,33 +8,21 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> - <test name="AdminCreateCategoryFromProductPage"> + <test name="AdminCreateCategoryFromProductPageTest"> <annotations> - <features value="Category"/> - <stories value="Admin should be able to create category from the product page"/> + <features value="Catalog"/> + <stories value="Create/Edit Category in Admin"/> <description value="Admin should be able to create category from the product page" /> <severity value="AVERAGE" /> <testCaseId value="MC-234" /> - <group value="Catalog" /> + <group value="Catalog"/> </annotations> <before> - <!-- Create new category in the product page with the category of AdminCreateCategoryFromProductPage --> + <!-- Login as admin --> <createData entity="SimpleTwo" stepKey="simpleProduct" /> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - - <!--Navigate to product page --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <waitForPageLoad stepKey="waitForProductIndexPage"/> - - <!-- Click first example product --> - <click stepKey="clickFirstExampleProduct" selector="{{AdminProductCategoryCreationSection.firstExampleProduct}}" /> - <waitForPageLoad stepKey="waitForSpecificProductPage"/> - - <!-- Fill out the form for the new category --> - <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> - <argument name="categoryName" value="{{_defaultCategory.name}}" /> - </actionGroup> </before> + <after> <!-- Delete the created category --> <actionGroup ref="DeleteMostRecentCategory" stepKey="getRidOfCreatedCategory" /> @@ -42,6 +30,22 @@ <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> </after> + <!-- Find the product that we just created using the product grid and go to its page--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForAdminProductGridLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> + <argument name="product" value="SimpleTwo"/> + </actionGroup> + <waitForPageLoad stepKey="waitForFiltersToBeApplied"/> + <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + + <!-- Fill out the form for the new category --> + <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> + <argument name="categoryName" value="{{_defaultCategory.name}}" /> + </actionGroup> + <!-- Check that category was created --> <actionGroup ref="CategoryPresent" stepKey="checkIfCategoryPresent"> <argument name="categoryName" value="{{_defaultCategory.name}}" /> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml index 49774539cda7c..0c38bbc518649 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -20,6 +20,23 @@ </annotations> <before> + <!-- Create the attribute we will be modifying --> + <createData entity="productAttributeWithTwoOptions" stepKey="createModifiableProductAttribute"/> + + <!-- Create the two attributes the product will have --> + <createData entity="productAttributeOption1" stepKey="createModifiableProductAttributeOption1"> + <requiredEntity createDataKey="createModifiableProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createModifiableProductAttributeOption2"> + <requiredEntity createDataKey="createModifiableProductAttribute"/> + </createData> + + <!-- Add the product to the default set --> + <createData entity="AddToDefaultSet" stepKey="createModifiableAddToAttributeSet"> + <requiredEntity createDataKey="createModifiableProductAttribute"/> + </createData> + + <!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. --> <!-- Create the category the product will be a part of --> <createData entity="ApiCategory" stepKey="createCategory"/> @@ -87,37 +104,40 @@ <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> + <deleteData createDataKey="createModifiableProductAttribute" stepKey="deleteModifiableProductAttribute"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> </after> <!-- Get the current option of the attribute before it was changed --> <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/> - <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad" /> - <grabTextFrom stepKey="getBeforeOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}" /> + <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/> + <grabTextFrom stepKey="getBeforeOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}"/> <!-- Find the product that we just created using the product grid --> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> - <argument name="product" value="ApiConfigurableProduct" /> + <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> + <waitForPageLoad stepKey="waitForProductFilterLoad"/> <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad" /> + <waitForPageLoad stepKey="waitForProductPageLoad"/> <!-- change the option on the first attribute --> - <click stepKey="clickFirstAttribute" selector="{{ModifyAttributes.nthExistingAttribute('1')}}" /> - <click stepKey="clickSecondAttributeOption" selector="{{ModifyAttributes.nthAttributeOption('1', '2')}}" /> + <click stepKey="clickFirstAttribute" selector="{{ModifyAttributes.nthExistingAttribute('1')}}"/> + + <click stepKey="clickSecondAttributeOption" selector="{{ModifyAttributes.nthAttributeOption('1', '2')}}"/> <!-- Save the product --> - <click stepKey="saveProductAttribute" selector="{{AdminProductFormActionSection.saveButton}}" /> - <waitForPageLoad stepKey="waitForProductSaved" /> - <see stepKey="assertSuccess" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product." /> + <click stepKey="saveProductAttribute" selector="{{AdminProductFormActionSection.saveButton}}"/> + <see stepKey="assertSuccess" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."/> <!-- Go back to the configurable product page and check to see if it has changed --> <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage2"/> - <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad2" /> - <grabTextFrom stepKey="getCurrentOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}" /> + <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad2"/> + <grabTextFrom stepKey="getCurrentOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}"/> <assertNotEquals expected="{$getBeforeOption}" expectedType="string" actual="{$getCurrentOption}" actualType="string" stepKey="assertNotEquals"/> </test> From 6f4bcfa62f1e95223be6d914c4bc338d73b0d10b Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 8 Jun 2018 12:50:17 -0500 Subject: [PATCH 089/133] MC-234: Admin should be able to create category from the product page - Add waitForPageLoad that was causing test failure --- .../Catalog/ActionGroup/CustomOptionsActionGroup.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml index 770e50023689a..0e731ac66bfb6 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml @@ -22,7 +22,10 @@ <!-- opens the custom option panel and clicks add options --> <click stepKey="openCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}"/> + <waitForPageLoad stepKey="waitForCustomOptionsOpen"/> + <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}}"/> @@ -42,6 +45,7 @@ <!-- close the custom option dropdown --> <click stepKey="closeCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}"/> + <waitForPageLoad stepKey="waitForCustomOptionsClose"/> </actionGroup> From 11ce38983bbfe37a43f8dc8ad7fa23d37219e7fe Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 8 Jun 2018 14:24:23 -0500 Subject: [PATCH 090/133] MC-234: Admin should be able to create category from the product page - Fix errors encountered when running tests on Jenkins --- .../ActionGroup/AdminCategoryActionGroup.xml | 17 +++++++++-------- .../ActionGroup/CustomOptionsActionGroup.xml | 8 +------- .../AdminProductCategoryCreationSection.xml | 15 +++++++-------- .../AdminCreateCategoryFromProductPageTest.xml | 14 +++++++------- .../Test/SimpleProductTwoCustomOptionsTest.xml | 7 +++++-- 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index caa92522914b1..9647f6228aea4 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -123,23 +123,24 @@ <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}}" /> + <click stepKey="clickNewCategory" selector="{{AdminProductCategoryCreationSection.newCategory}}"/> <waitForPageLoad stepKey="waitForFieldSet"/> - <fillField stepKey="fillCategoryName" selector="{{AdminProductCategoryCreationSection.nameInput}}" userInput="{{categoryName}}" /> + <fillField stepKey="fillCategoryName" selector="{{AdminProductCategoryCreationSection.nameInput}}" userInput="{{categoryName}}"/> - <click stepKey="clickParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategory}}" /> + <!-- 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="clickDefaultParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategoryDropdownDefaultOption}}" /> - - <click stepKey="createCategory" selector="{{AdminProductCategoryCreationSection.createCategory}}" /> - + <click stepKey="createCategory" selector="{{AdminProductCategoryCreationSection.createCategory}}"/> <waitForPageLoad stepKey="waitForCategoryCreated"/> - </actionGroup> <!-- Actions to delete the category last made --> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml index 0e731ac66bfb6..0409c3f195013 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/CustomOptionsActionGroup.xml @@ -20,16 +20,13 @@ <argument name="productOption2"/> </arguments> - <!-- opens the custom option panel and clicks add options --> - <click stepKey="openCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}"/> - <waitForPageLoad stepKey="waitForCustomOptionsOpen"/> - <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 --> @@ -43,9 +40,6 @@ <fillField stepKey="fillInValueTitle2" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{productOption2.title}}"/> <fillField stepKey="fillInValuePrice2" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{productOption2.price}}"/> - <!-- close the custom option dropdown --> - <click stepKey="closeCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}"/> - <waitForPageLoad stepKey="waitForCustomOptionsClose"/> </actionGroup> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml index b4e836ac253cf..a4566115099ef 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductCategoryCreationSection.xml @@ -9,15 +9,14 @@ <sections 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="AdminProductCategoryCreationSection"> - <element name="firstExampleProduct" type="button" selector=".data-row:nth-of-type(1)" /> - <element name="newCategory" type="button" selector="//button/span[text()='New Category']" /> - - <element name="nameInput" type="input" selector="input[name='name']" /> - - <element name="parentCategory" type="block" selector=".product_form_product_form_create_category_modal div[data-role='selected-option']" /> - <element name="parentCategoryDropdownDefaultOption" type="block" selector=".product_form_product_form_create_category_modal .action-menu-item._expended .admin__action-multiselect-label" /> - <element name="createCategory" type="button" selector="#save" /> + <element name="firstExampleProduct" type="button" selector=".data-row:nth-of-type(1)"/> + <element name="newCategory" type="button" selector="//button/span[text()='New Category']"/> + <element name="nameInput" type="input" selector="input[name='name']"/> + <element name="parentCategory" type="block" selector=".product_form_product_form_create_category_modal div[data-role='selected-option']"/> + <element name="parentSearch" type="input" selector="aside input[data-role='advanced-select-text']"/> + <element name="parentSearchResult" type="block" selector="aside .admin__action-multiselect-menu-inner"/> + <element name="createCategory" type="button" selector="#save"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml index a866b9bd9937f..696d82c565a0f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml @@ -13,19 +13,19 @@ <features value="Catalog"/> <stories value="Create/Edit Category in Admin"/> <description value="Admin should be able to create category from the product page" /> - <severity value="AVERAGE" /> - <testCaseId value="MC-234" /> - <group value="Catalog"/> + <severity value="AVERAGE"/> + <testCaseId value="MC-234"/> + <group value="Levi"/> </annotations> <before> <!-- Login as admin --> - <createData entity="SimpleTwo" stepKey="simpleProduct" /> + <createData entity="SimpleTwo" stepKey="simpleProduct"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> <!-- Delete the created category --> - <actionGroup ref="DeleteMostRecentCategory" stepKey="getRidOfCreatedCategory" /> + <actionGroup ref="DeleteMostRecentCategory" stepKey="getRidOfCreatedCategory"/> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> </after> @@ -43,12 +43,12 @@ <!-- Fill out the form for the new category --> <actionGroup ref="FillNewProductCategory" stepKey="FillNewProductCategory"> - <argument name="categoryName" value="{{_defaultCategory.name}}" /> + <argument name="categoryName" value="{{_defaultCategory.name}}"/> </actionGroup> <!-- Check that category was created --> <actionGroup ref="CategoryPresent" stepKey="checkIfCategoryPresent"> - <argument name="categoryName" value="{{_defaultCategory.name}}" /> + <argument name="categoryName" value="{{_defaultCategory.name}}"/> </actionGroup> </test> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml index 37f2847e985ac..f3f17ef531993 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml @@ -16,7 +16,7 @@ <description value="Admin should be able to create simple product with two custom options"/> <severity value="AVERAGE"/> <testCaseId value="MC-248"/> - <group value="Catalog"/> + <group value="Levi"/> </annotations> <before> <!-- log in as admin --> @@ -39,7 +39,10 @@ </actionGroup> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> </after> - <!-- ADD TEST STEPS HERE --> + + <!-- opens the custom option panel and clicks add options --> + <click stepKey="openCustomizableOptions" selector="{{AdminProductCustomizableOptionsSection.customezableOptions}}"/> + <waitForPageLoad stepKey="waitForCustomOptionsOpen"/> <!-- Create a custom option with 2 values --> <actionGroup ref="CreateCustomRadioOptions" stepKey="createCustomOption1"> From 756a72e6b33e034294b97e7ab8a636aba0a9fe2d Mon Sep 17 00:00:00 2001 From: Deepty Thampy <dthampy@magento.com> Date: Fri, 8 Jun 2018 14:30:55 -0500 Subject: [PATCH 091/133] MAGETWO-91529: Restricted admin user can remove product from other websites - updated data fixtures --- .../FunctionalTest/Analytics/Data/UserData.xml | 11 +++++++++++ .../User/Section/AdminEditRoleInfoSection.xml | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Data/UserData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Data/UserData.xml index 65ddfa7bb9559..c15e6004ed64a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Data/UserData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Analytics/Data/UserData.xml @@ -18,5 +18,16 @@ <data key="interface_local">en_US</data> <data key="is_active">true</data> <data key="current_password">123123q</data> +</entity> + <entity name="restrictedWebUser" type="user"> + <data key="username" unique="suffix">restrictedWebUser</data> + <data key="firstname">restricted</data> + <data key="lastname">webUser</data> + <data key="email" unique="prefix">restrictedWebUser@example.com</data> + <data key="password">123123q</data> + <data key="password_confirmation">123123q</data> + <data key="interface_local">en_US</data> + <data key="is_active">true</data> + <data key="current_password">123123q</data> </entity> </entities> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml index 3e5b4ac6ecc88..69d1fdea9cb51 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/User/Section/AdminEditRoleInfoSection.xml @@ -12,6 +12,10 @@ <element name="roleResourcesTab" type="button" selector="#role_info_tabs_account"/> <element name="backButton" type="button" selector="button[title='Back']"/> <element name="resetButton" type="button" selector="button[title='Reset']"/> + <element name="deleteButton" type="button" selector="button[title='Delete Role']"/> <element name="saveButton" type="button" selector="button[title='Save Role']"/> + <element name="message" type="text" selector=".modal-popup.confirm div.modal-content"/> + <element name="cancel" type="button" selector=".modal-popup.confirm button.action-dismiss"/> + <element name="ok" type="button" selector=".modal-popup.confirm button.action-accept" timeout="60"/> </section> </sections> From 6f13e93f4ee7016344fabce45129d563da6ae487 Mon Sep 17 00:00:00 2001 From: Levi Villarreal <villarreallevi@gmail.com> Date: Fri, 8 Jun 2018 18:01:18 -0500 Subject: [PATCH 092/133] MC-234: Admin should be able to create category from the product page - Account for admin product creation on b2b and ee --- .../Catalog/Section/AdminProductAttributeSetSection.xml | 6 ++---- .../Catalog/Test/AdminCreateCategoryFromProductPageTest.xml | 2 +- .../Catalog/Test/SimpleProductTwoCustomOptionsTest.xml | 2 +- .../Test/AdminConfigurableProductUpdateAttributeTest.xml | 6 ++---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml index 049214bae35b3..011b2fce3a780 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductAttributeSetSection.xml @@ -18,9 +18,7 @@ <element name="FolderName" type="text" selector="//span[text()='{{var1}}']" parameterized="true"/> </section> <section name="ModifyAttributes"> - <!-- Parameter is the order number of the attribute on the page (1 is the newest) --> - <element name="nthExistingAttribute" type="block" selector=".admin__field:nth-of-type({{numElement}}) .admin__control-select" parameterized="true"/> - <!-- First parameter is the order number of the attribute on the page, 2nd parameter is the number option in the dropdown (1 for blank) --> - <element name="nthAttributeOption" type="block" selector=".admin__field:nth-of-type({{numElement}}) .admin__control-select option:nth-of-type({{numOption}})" parameterized="true"/> + <!-- Parameter is the attribute name --> + <element name="nthExistingAttribute" type="select" selector="//*[text()='{{attributeName}}']/../..//select" parameterized="true"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml index 696d82c565a0f..7c81f4472e92a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminCreateCategoryFromProductPageTest.xml @@ -15,7 +15,7 @@ <description value="Admin should be able to create category from the product page" /> <severity value="AVERAGE"/> <testCaseId value="MC-234"/> - <group value="Levi"/> + <group value="Catalog"/> </annotations> <before> <!-- Login as admin --> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml index f3f17ef531993..2710002d625d7 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SimpleProductTwoCustomOptionsTest.xml @@ -16,7 +16,7 @@ <description value="Admin should be able to create simple product with two custom options"/> <severity value="AVERAGE"/> <testCaseId value="MC-248"/> - <group value="Levi"/> + <group value="Catalog"/> </annotations> <before> <!-- log in as admin --> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml index 0c38bbc518649..2a2c331aa158f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -36,7 +36,6 @@ <requiredEntity createDataKey="createModifiableProductAttribute"/> </createData> - <!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. --> <!-- Create the category the product will be a part of --> <createData entity="ApiCategory" stepKey="createCategory"/> @@ -111,6 +110,7 @@ <!-- Get the current option of the attribute before it was changed --> <amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/> <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/> + <grabTextFrom stepKey="getBeforeOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}"/> <!-- Find the product that we just created using the product grid --> @@ -126,9 +126,7 @@ <waitForPageLoad stepKey="waitForProductPageLoad"/> <!-- change the option on the first attribute --> - <click stepKey="clickFirstAttribute" selector="{{ModifyAttributes.nthExistingAttribute('1')}}"/> - - <click stepKey="clickSecondAttributeOption" selector="{{ModifyAttributes.nthAttributeOption('1', '2')}}"/> + <selectOption stepKey="clickFirstAttribute" selector="{{ModifyAttributes.nthExistingAttribute($$createModifiableProductAttribute.default_frontend_label$$)}}" userInput="option1"/> <!-- Save the product --> <click stepKey="saveProductAttribute" selector="{{AdminProductFormActionSection.saveButton}}"/> From 7433de444d6d4cb296c7dfde7e831616a1cb33fc Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia <lorenzo.stramaccia@magespecialist.it> Date: Sat, 9 Jun 2018 15:19:21 +0200 Subject: [PATCH 093/133] Fix magento-engcom/msi#1339 issue --- .../testsuite/Magento/Sales/Service/V1/ShipmentCreateTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentCreateTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentCreateTest.php index 8c8130d2b3949..d8b3c5cac52aa 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentCreateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentCreateTest.php @@ -43,13 +43,13 @@ public function testInvoke() 'qty' => $orderItem->getQtyOrdered(), 'additional_data' => null, 'description' => null, - 'entity_id' => null, + 'entity_id' => 1, 'name' => null, 'parent_id' => null, 'price' => null, 'product_id' => null, 'row_total' => null, - 'sku' => null, + 'sku' => 'simple', 'weight' => null, ], ]; From eee2e7ccd7aef585e973df28719b25941e7e401e Mon Sep 17 00:00:00 2001 From: Steven de Jong <steven.de.jong@guapa.nl> Date: Thu, 7 Jun 2018 16:07:17 +0200 Subject: [PATCH 094/133] #15308 extraneous margin removed extraneous margin and compensated padding and set both to 0, which creates the same effect --- .../luma/Magento_Catalog/web/css/source/module/_listings.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less index 01b8c7be93aec..ba118a21ab73e 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less @@ -167,11 +167,11 @@ .column.main { .product { &-items { - margin-left: -@indent__base; + margin-left: 0; } &-item { - padding-left: @indent__base; + padding-left: 0; } } } From 9e5757df2e1ebfc75e93c9d793473662ec0e761e Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia <lorenzo.stramaccia@magespecialist.it> Date: Sun, 10 Jun 2018 11:33:41 +0200 Subject: [PATCH 095/133] Fix Magento\Sales\Service\V1\ShipmentGetTest::testShipmentGet --- .../Magento/Sales/Service/V1/ShipmentGetTest.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php index aaa7a5a6d4436..2b7e76aee0751 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php @@ -5,6 +5,8 @@ */ namespace Magento\Sales\Service\V1; +use Magento\Framework\Api\ExtensibleDataInterface; +use Magento\Framework\Api\SimpleDataObjectConverter; use Magento\TestFramework\TestCase\WebapiAbstract; /** @@ -57,7 +59,18 @@ public function testShipmentGet() unset($data['tracks']); foreach ($data as $key => $value) { if (!empty($value)) { - $this->assertEquals($shipment->getData($key), $value, $key); + if ($key === ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY) { + foreach ($value as $extensionAttributeKey => $extensionAttributeValue) { + $methodName = 'get' . + SimpleDataObjectConverter::snakeCaseToUpperCamelCase($extensionAttributeKey); + $this->assertEquals( + $shipment->getExtensionAttributes()->$methodName(), + $extensionAttributeValue + ); + } + } else { + $this->assertEquals($shipment->getData($key), $value, $key); + } } } $shipmentItem = $this->objectManager->get(\Magento\Sales\Model\Order\Shipment\Item::class); From 1555b967b865b6a31f21b68461a8516254627d6f Mon Sep 17 00:00:00 2001 From: Vishal Gelani <vishalgelani99@gmail.com> Date: Mon, 11 Jun 2018 12:44:37 +0530 Subject: [PATCH 096/133] Fixed coding standard error --- .../testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php index 2b7e76aee0751..efcde4ab49e01 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php @@ -60,12 +60,13 @@ public function testShipmentGet() foreach ($data as $key => $value) { if (!empty($value)) { if ($key === ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY) { - foreach ($value as $extensionAttributeKey => $extensionAttributeValue) { + foreach ($value as $key => $value) { + $simpleObject = $this->objectManager->get(Magento\Framework\Api\SimpleDataObjectConverter::class); $methodName = 'get' . - SimpleDataObjectConverter::snakeCaseToUpperCamelCase($extensionAttributeKey); + $simpleObject->snakeCaseToUpperCamelCase($key); $this->assertEquals( $shipment->getExtensionAttributes()->$methodName(), - $extensionAttributeValue + $value ); } } else { From 039e71c5ced19acad3ab4b287c75188d7b1f837e Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia <lorenzo.stramaccia@magespecialist.it> Date: Mon, 11 Jun 2018 11:00:41 +0200 Subject: [PATCH 097/133] Revert "Fixed coding standard error" This reverts commit 1555b967b865b6a31f21b68461a8516254627d6f. --- .../testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php index efcde4ab49e01..2b7e76aee0751 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentGetTest.php @@ -60,13 +60,12 @@ public function testShipmentGet() foreach ($data as $key => $value) { if (!empty($value)) { if ($key === ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY) { - foreach ($value as $key => $value) { - $simpleObject = $this->objectManager->get(Magento\Framework\Api\SimpleDataObjectConverter::class); + foreach ($value as $extensionAttributeKey => $extensionAttributeValue) { $methodName = 'get' . - $simpleObject->snakeCaseToUpperCamelCase($key); + SimpleDataObjectConverter::snakeCaseToUpperCamelCase($extensionAttributeKey); $this->assertEquals( $shipment->getExtensionAttributes()->$methodName(), - $value + $extensionAttributeValue ); } } else { From 0501e1794641116c99c2e69d6adf383ce26d9adb Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Mon, 11 Jun 2018 13:53:32 +0300 Subject: [PATCH 098/133] 1334: CreateOrderBackendTest rework to support MSI 'Reorder button' new behaviour. --- .../Braintree/Test/TestCase/CreateOrderBackendTest.xml | 6 +++--- .../Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml | 4 ++-- .../tests/app/Magento/Sales/Test/etc/testcase.xml | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml index 8ffcab68cdc62..cf3b3ae407a49 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml @@ -28,7 +28,7 @@ <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Ship, Reorder, Edit</data> - <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> @@ -57,7 +57,7 @@ <data name="configData" xsi:type="string">braintree, braintree_sale</data> <data name="status" xsi:type="string">Processing</data> <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Hold, Ship, Reorder</data> - <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> @@ -83,7 +83,7 @@ <data name="creditCard/dataset" xsi:type="string">visa_braintree_fraud_rejected</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> - <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" /> </variation> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml index 439b8a4492a1a..c4e03b94d2ada 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml @@ -19,7 +19,7 @@ </data> <data name="payment/method" xsi:type="string">cashondelivery</data> <data name="configData" xsi:type="string">cashondelivery</data> - <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductsOutOfStock" /> </variation> @@ -35,7 +35,7 @@ </data> <data name="payment/method" xsi:type="string">cashondelivery</data> <data name="configData" xsi:type="string">cashondelivery</data> - <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> + <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> <constraint name="Magento\Sales\Test\Constraint\AssertReorderButtonIsNotVisibleOnFrontend" /> </variation> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml index c7c4a2276e4b7..28b7e3a69f67e 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml @@ -36,7 +36,8 @@ <step name="fillShippingAddress" module="Magento_Sales" next="selectShippingMethodForOrder" /> <step name="selectShippingMethodForOrder" module="Magento_Sales" next="selectPaymentMethodForOrder" /> <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="submitOrder" /> - <step name="submitOrder" module="Magento_Sales" /> + <step name="submitOrder" module="Magento_Sales" next="createShipment"/> + <step name="createShipment" module="Magento_Sales"/> </scenario> <scenario name="CreateOrderBackendPartOneTest" firstStep="setupConfiguration"> <step name="setupConfiguration" module="Magento_Config" next="createProducts" /> From ab33715de07bff5e70bf041af0f26d81b46ac2b4 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Mon, 11 Jun 2018 10:07:13 -0500 Subject: [PATCH 099/133] Merge remote-tracking branch 'upstream/2.3-develop' into MAGETWO-91529 # Conflicts: # app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php --- .../Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php index 3a30909650191..64b21cc53801f 100755 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php @@ -522,14 +522,14 @@ public function testSetupAttributeMetaDefaultAttribute( ) ->willReturn($expected); - $this->arrayManagerMock->expects($this->once()) + $this->arrayManagerMock->expects($this->any()) ->method('merge') ->with( $this->anything(), $this->anything(), $this->callback( function ($value) use ($attributeOptionsExpected) { - return $value['options'] === $attributeOptionsExpected; + return isset($value['options']) ? $value['options'] === $attributeOptionsExpected : true; } ) ) From 2e7c5795a8f8274c0ca4611dd2aec4c266186d22 Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza <enarc@atwix.com> Date: Mon, 11 Jun 2018 18:20:28 +0200 Subject: [PATCH 100/133] Remove unnecessary parameter from invoking toHtml() method --- .../Magento/Wishlist/view/frontend/templates/item/list.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml b/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml index c2172afab94de..e98981cbd0c95 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml @@ -19,7 +19,7 @@ $columns = $block->getColumns(); <li data-row="product-item" class="product-item" id="item_<?= $block->escapeHtmlAttr($item->getId()) ?>"> <div class="product-item-info" data-container="product-grid"> <?php foreach ($columns as $column): ?> - <?php $column->setItem($item); echo $column->toHtml($item);?> + <?php $column->setItem($item); echo $column->toHtml();?> <?php endforeach; ?> </div> </li> From 507051b367fe551b99b475880d77366202fd8f49 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Mon, 11 Jun 2018 21:21:40 -0500 Subject: [PATCH 101/133] MAGETWO-91529: Restricted admin user can remove product from other websites - Fix static test failures --- .../Product/Form/Modifier/AttributeSetTest.php | 7 +++++-- .../Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php | 1 + .../Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php index 6deb154d02a83..5fc6231b03735 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php @@ -99,8 +99,11 @@ public function testModifyMetaLocked($locked) ->method('isLockedAttribute') ->willReturn($locked); $modifyMeta = $this->getModel()->modifyMeta([AbstractModifier::DEFAULT_GENERAL_PANEL => []]); - $this->assertEquals($locked, - $modifyMeta[AbstractModifier::DEFAULT_GENERAL_PANEL]['children']['attribute_set_id']['arguments']['data']['config']['disabled']); + $children = $modifyMeta[AbstractModifier::DEFAULT_GENERAL_PANEL]['children']; + $this->assertEquals( + $locked, + $children['attribute_set_id']['arguments']['data']['config']['disabled'] + ); } public function modifyMetaLockedDataProvider() diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php index 64b21cc53801f..22bb712d42f0f 100755 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php @@ -546,6 +546,7 @@ function ($value) use ($attributeOptionsExpected) { /** * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function setupAttributeMetaDataProvider() { diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php index ac7c8ab655916..730a9763e06db 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php @@ -41,6 +41,7 @@ * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) + * @SuppressWarnings(PHPMD.NPathComplexity) * @since 101.0.0 */ class Eav extends AbstractModifier From 206059fdac8fa2dd669d7f7909afb1697f739b7d Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Mon, 11 Jun 2018 21:29:42 -0500 Subject: [PATCH 102/133] MAGETWO-91529: Restricted admin user can remove product from other websites - Fix unit test failures --- .../Product/Form/Modifier/CustomOptionsTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CustomOptionsTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CustomOptionsTest.php index e2e9fe9b2b1f9..659f7346faba4 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CustomOptionsTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CustomOptionsTest.php @@ -10,6 +10,14 @@ class CustomOptionsTest extends AbstractModifierTest { + protected function setUp() + { + parent::setUp(); + $this->arrayManagerMock->expects($this->any()) + ->method('merge') + ->willReturnArgument(1); + } + /** * {@inheritdoc} */ From 0a76e94ae2bd8294eadfe0d3fe9d092df734e7de Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Mon, 11 Jun 2018 21:46:45 -0500 Subject: [PATCH 103/133] MAGETWO-91529: Restricted admin user can remove product from other websites - Fix integration test failures --- .../Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php index fd0f6e98840c9..22bb76ca9222d 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php @@ -6,6 +6,7 @@ namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier; +use Magento\Catalog\Model\Product; use Magento\TestFramework\Helper\CacheCleaner; /** @@ -29,6 +30,8 @@ protected function setUp() $store = $objectManager->create(\Magento\Store\Model\Store::class); $store->load('admin'); $registry->register('current_store', $store); + $product = $objectManager->create(Product::class); + $registry->register('current_product', $product); $this->object = $objectManager->create(Categories::class); } From ddcf91fdc2f9db6cfa4036fa46e2789a96f1d038 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Mon, 11 Jun 2018 22:19:16 -0500 Subject: [PATCH 104/133] MAGETWO-91529: Restricted admin user can remove product from other websites - Fix static test failures --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php index 730a9763e06db..7cd81419c0347 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php @@ -41,7 +41,7 @@ * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) - * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @since 101.0.0 */ class Eav extends AbstractModifier From d7e77e617e54d586a162ef0d63d74eba33d0efdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karla=20Saarem=C3=A4e?= <karlasaaremae@gmail.com> Date: Mon, 11 Jun 2018 16:04:54 +0300 Subject: [PATCH 105/133] added new variables --- lib/web/css/source/lib/variables/_buttons.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/web/css/source/lib/variables/_buttons.less b/lib/web/css/source/lib/variables/_buttons.less index 82f618faa1d0f..8c31c16143859 100644 --- a/lib/web/css/source/lib/variables/_buttons.less +++ b/lib/web/css/source/lib/variables/_buttons.less @@ -47,6 +47,9 @@ @button__active__gradient-color-end: false; // Primary button +@button-primary__font-family: @button__font-family; +@button-primary__font-size: @button__font-size; +@button-primary__font-weight: @button__font-weight; @button-primary__line-height: false; @button-primary__width: false; @button-primary__margin: false; From c4de267a7bf32adf50d188531689de9cf75f0f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karla=20Saarem=C3=A4e?= <karlasaaremae@gmail.com> Date: Mon, 11 Jun 2018 16:06:50 +0300 Subject: [PATCH 106/133] added new primary button variables --- lib/web/css/source/lib/_buttons.less | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/web/css/source/lib/_buttons.less b/lib/web/css/source/lib/_buttons.less index 679c4b11fbaac..a92093b742902 100644 --- a/lib/web/css/source/lib/_buttons.less +++ b/lib/web/css/source/lib/_buttons.less @@ -276,6 +276,9 @@ // --------------------------------------------- .lib-button-primary( + @_button-font-family: @button-primary__font-family, + @_button-font-size: @button-primary__font-size, + @_button-font-weight: @button-primary__font-weight, @_button-line-height: @button-primary__line-height, @_button-width: @button-primary__width, @_button-margin: @button-primary__margin, @@ -299,6 +302,9 @@ @_button-gradient-direction: @button-primary__gradient-direction ) { .lib-button( + @_button-font-family: @_button-font-family, + @_button-font-size: @_button-font-size, + @_button-font-weight: @_button-font-weight, @_button-line-height: @_button-line-height, @_button-width: @_button-width, @_button-margin: @_button-margin, From f4b014d5782c6fa5b84a77f27c838b472c3ec40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karla=20Saarem=C3=A4e?= <karlasaaremae@gmail.com> Date: Mon, 11 Jun 2018 09:52:20 +0300 Subject: [PATCH 107/133] fix for dropdown toggle icon --- app/design/frontend/Magento/blank/web/css/source/_extends.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/web/css/source/_extends.less b/app/design/frontend/Magento/blank/web/css/source/_extends.less index a36934111eb06..c177f91e9e7e8 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_extends.less +++ b/app/design/frontend/Magento/blank/web/css/source/_extends.less @@ -1402,7 +1402,7 @@ &.active { > .title { .lib-icon-font-symbol( - @_icon-font-content: @icon-prev, + @_icon-font-content: @icon-up, @_icon-font-position: after ); } From f28471e86936de39d81df3a669fd7e23668451ed Mon Sep 17 00:00:00 2001 From: Valerij Ivashchenko <likemusic@yandex.ru> Date: Mon, 11 Jun 2018 12:43:30 +0300 Subject: [PATCH 108/133] extend default config instead overwrite --- lib/web/mage/adminhtml/form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/adminhtml/form.js b/lib/web/mage/adminhtml/form.js index e136e8c0f7354..487c71484e4c5 100644 --- a/lib/web/mage/adminhtml/form.js +++ b/lib/web/mage/adminhtml/form.js @@ -389,7 +389,7 @@ define([ var idTo, idFrom, values, fromId, radioFrom; if (config) { - this._config = config; + this._config = jQuery.extend(this._config, config); } for (idTo in elementsMap) { //eslint-disable-line guard-for-in From 7782bdc818f17e9ab1d1f83df4a251c4b37a09b4 Mon Sep 17 00:00:00 2001 From: Vlad Veselov <orlangur@users.noreply.github.com> Date: Tue, 12 Jun 2018 10:27:12 +0300 Subject: [PATCH 109/133] Simplify echo statement --- .../Magento/Wishlist/view/frontend/templates/item/list.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml b/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml index e98981cbd0c95..ef02768c46a83 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml @@ -19,7 +19,7 @@ $columns = $block->getColumns(); <li data-row="product-item" class="product-item" id="item_<?= $block->escapeHtmlAttr($item->getId()) ?>"> <div class="product-item-info" data-container="product-grid"> <?php foreach ($columns as $column): ?> - <?php $column->setItem($item); echo $column->toHtml();?> + <?= $column->setItem($item)->toHtml();?> <?php endforeach; ?> </div> </li> From d4a7a958cc77920fb0b4ebb9d33abea9faadb37e Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Tue, 12 Jun 2018 08:12:54 -0500 Subject: [PATCH 110/133] MAGETWO-91608: SEO-friendly URL for category page not working --- app/code/Magento/Catalog/Controller/Adminhtml/Category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index 88c371cb179f9..42678b6b5160b 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -48,7 +48,7 @@ public function __construct( */ private function resolveStoreId() : int { - return (int) $this->getRequest()->getParam('store_id', Store::DEFAULT_STORE_ID); + return (int) $this->getRequest()->getParam('store', Store::DEFAULT_STORE_ID); } /** From ce5fead53437424282cd01b9aa9902b93080ace8 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Tue, 12 Jun 2018 10:42:14 -0500 Subject: [PATCH 111/133] MAGETWO-91608: SEO-friendly URL for category page not working -Functional test --- .../ActionGroup/AdminCategoryActionGroup.xml | 20 +++++ .../AdminCategoryBasicFieldSection.xml | 3 + .../AdminCategoryMainActionsSection.xml | 3 + .../Section/AdminCategorySEOSection.xml | 2 + .../AdminUpdateCategoryStoreUrlKeyTest.xml | 77 +++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminUpdateCategoryStoreUrlKeyTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index 96e40e348a6f2..d7f778068ceac 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -128,6 +128,26 @@ <see selector="{{AdminCategoryBasicFieldSection.FieldError('uid')}}" userInput="This is a required field." stepKey="seeErrorMessage"/> </actionGroup> + + <actionGroup name="switchCategoryStoreView"> + <arguments> + <argument name="Store"/> + <argument name="CatName"/> + </arguments> + <amOnPage url="{{AdminCategoryPage.page}}" stepKey="amOnCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(CatName)}}" stepKey="navigateToCreatedCategory" /> + <waitForPageLoad stepKey="waitForPageLoad2"/> + <waitForLoadingMaskToDisappear stepKey="waitForSpinner"/> + <scrollToTopOfPage stepKey="scrollToToggle"/> + <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}" stepKey="openStoreViewDropDown"/> + <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption(Store)}}" stepKey="selectStoreView"/> + <waitForPageLoad stepKey="waitForPageLoad3"/> + <waitForLoadingMaskToDisappear stepKey="waitForSpinner2"/> + <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}" stepKey="selectStoreViewAccept"/> + <waitForPageLoad stepKey="waitForStoreViewChangeLoad"/> + </actionGroup> + <actionGroup name="navigateToCreatedCategory"> <arguments> <argument name="Category"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml index 26f56f6176f98..7de2390e5348a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml @@ -11,9 +11,12 @@ <section name="AdminCategoryBasicFieldSection"> <element name="IncludeInMenu" type="checkbox" selector="input[name='include_in_menu']"/> <element name="includeInMenuLabel" type="text" selector="input[name='include_in_menu']+label"/> + <element name="includeInMenuUseDefault" type="checkbox" selector="input[name='use_default[include_in_menu]']"/> <element name="EnableCategory" type="checkbox" selector="input[name='is_active']"/> <element name="enableCategoryLabel" type="text" selector="input[name='is_active']+label"/> + <element name="enableUseDefault" type="checkbox" selector="input[name='use_default[is_active]']"/> <element name="CategoryNameInput" type="input" selector="input[name='name']"/> + <element name="categoryNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/> <element name="ContentTab" type="input" selector="input[name='name']"/> <element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/> </section> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml index 3c806fbbea63f..e726e5bfb7c63 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml @@ -11,5 +11,8 @@ <section name="AdminCategoryMainActionsSection"> <element name="SaveButton" type="button" selector=".page-actions-inner #save" timeout="30"/> <element name="DeleteButton" type="button" selector=".page-actions-inner #delete" timeout="30"/> + <element name="CategoryStoreViewDropdownToggle" type="button" selector="#store-change-button"/> + <element name="CategoryStoreViewOption" type="button" selector="//div[contains(@class, 'store-switcher')]//a[normalize-space()='{{store}}']" parameterized="true"/> + <element name="CategoryStoreViewModalAccept" type="button" selector=".modal-popup.confirm._show .action-accept"/> </section> </sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySEOSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySEOSection.xml index 679cd2d7bee0d..0e01660d5fce9 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySEOSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategorySEOSection.xml @@ -11,6 +11,8 @@ <section name="AdminCategorySEOSection"> <element name="SectionHeader" type="button" selector="div[data-index='search_engine_optimization']" timeout="30"/> <element name="UrlKeyInput" type="input" selector="input[name='url_key']"/> + <element name="UrlKeyDefaultValueCheckbox" type="button" selector="input[name='use_default[url_key]']"/> + <element name="UrlKeyRedirectCheckbox" type="button" selector="[data-index='url_key_create_redirect'] input[type='checkbox']"/> <element name="MetaTitleInput" type="input" selector="input[name='meta_title']"/> <element name="MetaKeywordsInput" type="textarea" selector="textarea[name='meta_keywords']"/> <element name="MetaDescriptionInput" type="textarea" selector="textarea[name='meta_description']"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminUpdateCategoryStoreUrlKeyTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminUpdateCategoryStoreUrlKeyTest.xml new file mode 100644 index 0000000000000..e29890befd860 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminUpdateCategoryStoreUrlKeyTest.xml @@ -0,0 +1,77 @@ +<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd"> + <test name="AdminUpdateCategoryStoreUrlKeyTest"> + <annotations> + <features value="SEO-friendly URL Key Update"/> + <stories value="Update SEO-friendly URL via the Admin"/> + <title value="SEO-friendly URL should update regardless of scope or redirect change."/> + <description value="SEO-friendly URL should update regardless of scope or redirect change."/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-92338"/> + <group value="category"/> + </annotations> + <after> + <actionGroup ref="DeleteCategory" stepKey="deleteCategory"> + <argument name="categoryEntity" value="_defaultCategory"/> + </actionGroup> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!-- Create category, change store view to default --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <actionGroup ref="CreateCategory" stepKey="createCategory"> + <argument name="categoryEntity" value="_defaultCategory"/> + </actionGroup> + + <!--Switch to "Default Store View" scope--> + <actionGroup ref="switchCategoryStoreView" stepKey="SwitchStoreView"> + <argument name="Store" value="_defaultStore.name"/> + <argument name="CatName" value="_defaultCategory.name"/> + </actionGroup> + <!--See "Use Default Value" checkboxes--> + <seeElement selector="{{AdminCategoryBasicFieldSection.enableUseDefault}}" stepKey="seeUseDefaultEnable"/> + <seeElement selector="{{AdminCategoryBasicFieldSection.includeInMenuUseDefault}}" stepKey="seeUseDefaultMenu"/> + <seeElement selector="{{AdminCategoryBasicFieldSection.categoryNameUseDefault}}" stepKey="seeUseDefaultName"/> + <!-- Update SEO key, uncheck "Create Redirect", confirm in frontend --> + <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/> + <uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckUseDefaultUrlKey"/> + <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{_defaultCategory.name_lwr}}-hattest" stepKey="enterURLKey"/> + <uncheckOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="uncheckRedirect1"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategoryAfterFirstSeoUpdate"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/> + <amOnPage url="" stepKey="goToStorefront"/> + <waitForPageLoad stepKey="waitForFrontendLoad"/> + <click stepKey="clickCategory" selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}"/> + <see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{_defaultCategory.name}}" stepKey="assertCategoryOnStorefront"/> + <seeInTitle userInput="{{_defaultCategory.name}}" stepKey="seeCategoryNameInTitle"/> + <seeInCurrentUrl stepKey="verifyUrlKey" url="{{_defaultCategory.name_lwr}}-hattest.html"/> + + <!-- Update SEO key to original, uncheck "Create Redirect", confirm in frontend, delete category --> + <!--Switch to "Default Store View" scope--> + <actionGroup ref="switchCategoryStoreView" stepKey="SwitchStoreView2"> + <argument name="Store" value="_defaultStore.name"/> + <argument name="CatName" value="_defaultCategory.name"/> + </actionGroup> + <click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection2"/> + <fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{_defaultCategory.name_lwr}}" stepKey="enterOriginalURLKey"/> + <uncheckOption selector="{{AdminCategorySEOSection.UrlKeyRedirectCheckbox}}" stepKey="uncheckRedirect2"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategoryAfterOriginalSeoKey"/> + <seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessageAfterOriginalSeoKey"/> + <amOnPage url="" stepKey="goToStorefrontAfterOriginalSeoKey"/> + <waitForPageLoad stepKey="waitForFrontendLoadAfterOriginalSeoKey"/> + <click stepKey="clickCategoryAfterOriginalSeoKey" selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}"/> + <see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{_defaultCategory.name}}" stepKey="assertCategoryOnStorefront2"/> + <seeInTitle userInput="{{_defaultCategory.name}}" stepKey="seeCategoryNameInTitle2"/> + <seeInCurrentUrl stepKey="verifyUrlKeyAfterOriginalSeoKey" url="{{_defaultCategory.name_lwr}}.html"/> + </test> +</tests> \ No newline at end of file From 3483dd585e507c9f7b6c9bd9c187ff0ed14e166a Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Tue, 12 Jun 2018 11:01:01 -0500 Subject: [PATCH 112/133] MAGETWO-91608: SEO-friendly URL for category page not working --- .../Catalog/Controller/Adminhtml/Category.php | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index 42678b6b5160b..1e0cb9f197a51 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -38,19 +38,6 @@ public function __construct( parent::__construct($context); } - /** - * Resolve store id - * - * Tries to take store id from store HTTP parameter - * @see Store - * - * @return int - */ - private function resolveStoreId() : int - { - return (int) $this->getRequest()->getParam('store', Store::DEFAULT_STORE_ID); - } - /** * Initialize requested category and put it into registry. * Root category can be returned, if inappropriate store/category is specified @@ -87,7 +74,7 @@ protected function _initCategory($getRootInstead = false) $this->_objectManager->get(\Magento\Framework\Registry::class)->register('category', $category); $this->_objectManager->get(\Magento\Framework\Registry::class)->register('current_category', $category); $this->_objectManager->get(\Magento\Cms\Model\Wysiwyg\Config::class) - ->setStoreId($this->getRequest()->getParam('store')); + ->setStoreId($storeId); return $category; } @@ -96,13 +83,28 @@ protected function _initCategory($getRootInstead = false) * * @return int */ - private function resolveCategoryId() + private function resolveCategoryId() : int { $categoryId = (int)$this->getRequest()->getParam('id', false); return $categoryId ?: (int)$this->getRequest()->getParam('entity_id', false); } + /** + * Resolve store id + * + * Tries to take store id from store HTTP parameter + * @see Store + * + * @return int + */ + private function resolveStoreId() : int + { + $storeId = (int)$this->getRequest()->getParam('store', false); + + return $storeId ?: (int)$this->getRequest()->getParam('store_id', Store::DEFAULT_STORE_ID); + } + /** * Build response for ajax request * From 8313fc3449092eabed03a457a4dfea2ef9e1746f Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Tue, 12 Jun 2018 11:02:49 -0500 Subject: [PATCH 113/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - builds stabilization --- .../Catalog/view/adminhtml/web/js/options.js | 4 +-- .../adminhtml/web/js/product-attributes.js | 7 ++-- .../Adminhtml/Product/AttributeTest.php | 19 +++++++---- .../Test/Integrity/HhvmCompatibilityTest.php | 32 ++++++++++++++++++- 4 files changed, 49 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index 6fb0c419956d8..4952c8bac250c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -181,8 +181,8 @@ define([ }); } editForm.on('submit', function () { - optionPanel.find('input') - .each(function() { + optionPanel.find('input') + .each(function () { optionsValues.push(this.name + '=' + jQuery(this).val()); }); jQuery('<input>') diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js index 0a0d024c2908e..01411523108cf 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js @@ -415,6 +415,7 @@ define([ $(function () { var editForm = $('#edit_form'); + $('#frontend_input').bind('change', function () { swatchProductAttributes.bindAttributeInputType(); }); @@ -435,11 +436,11 @@ define([ swatchVisualPanel = $('#swatch-visual-options-panel'), swatchTextPanel = $('#swatch-text-options-panel'); - activePanel = swatchTextPanel.is(":visible") ? swatchTextPanel : swatchVisualPanel; + activePanel = swatchTextPanel.is(':visible') ? swatchTextPanel : swatchVisualPanel; activePanel .find('table input') - .each(function() { + .each(function () { swatchValues.push(this.name + '=' + $(this).val()); }); @@ -451,7 +452,7 @@ define([ .val(JSON.stringify(swatchValues)) .prependTo(editForm); - [swatchVisualPanel, swatchTextPanel].forEach(function(el) { + [swatchVisualPanel, swatchTextPanel].forEach(function (el) { $(el).find('table') .replaceWith($('<div>').text($.mage.__('Sending swatch values as package.'))); }); diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php index 20c791b9c6268..ba99e43890e1a 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Swatches\Controller\Adminhtml\Product; use Magento\Framework\Exception\LocalizedException; @@ -20,7 +22,7 @@ class AttributeTest extends \Magento\TestFramework\TestCase\AbstractBackendContr * * @return string */ - private function getRandomColor() + private function getRandomColor() : string { return '#' . str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT); } @@ -31,7 +33,7 @@ private function getRandomColor() * @param int $optionsCount * @return array */ - private function getSwatchVisualDataSet($optionsCount) + private function getSwatchVisualDataSet(int $optionsCount) : array { $optionsData = []; $expectedOptionsLabels = []; @@ -69,7 +71,7 @@ private function getSwatchVisualDataSet($optionsCount) * @param int $optionsCount * @return array */ - private function getSwatchTextDataSet($optionsCount) + private function getSwatchTextDataSet(int $optionsCount) : array { $optionsData = []; $expectedOptionsLabels = []; @@ -106,7 +108,7 @@ private function getSwatchTextDataSet($optionsCount) * * @return array */ - private function getAttributePreset() + private function getAttributePreset() : array { return [ 'serialized_options' => '[]', @@ -147,7 +149,7 @@ private function getAttributePreset() * * @return array */ - public function getLargeSwatchesAmountAttributeData() + public function getLargeSwatchesAmountAttributeData() : array { $maxInputVars = ini_get('max_input_vars'); // Each option is at least 7 variables array for a visual swatch. @@ -168,8 +170,11 @@ public function getLargeSwatchesAmountAttributeData() * @param array $expectedLabels * @return void */ - public function testLargeOptionsDataSet($attributeData, $expectedOptionsCount, $expectedLabels) - { + public function testLargeOptionsDataSet( + array $attributeData, + int $expectedOptionsCount, + array $expectedLabels + ) { $this->getRequest()->setPostValue($attributeData); $this->dispatch('backend/catalog/product_attribute/save'); $entityTypeId = $this->_objectManager->create( diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php index e33b771b3c645..c552e0daa97df 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php @@ -47,6 +47,24 @@ class HhvmCompatibilityTest extends \PHPUnit\Framework\TestCase 'serialize_precision', ]; + /** + * Whitelist of variables allowed in files. + * + * @var array + */ + private $whitelistVarsInFiles = [ + 'max_input_vars' => [ + 'integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php', + 'integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php', + ] + ]; + + /** + * Test allowed directives. + * + * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + */ public function testAllowedIniGetSetDirectives() { $deniedDirectives = []; @@ -55,7 +73,19 @@ public function testAllowedIniGetSetDirectives() if ($fileDirectives) { $fileDeniedDirectives = array_diff($fileDirectives, $this->allowedDirectives); if ($fileDeniedDirectives) { - $deniedDirectives[$file] = array_unique($fileDeniedDirectives); + $deniedDirectivesInFile = array_unique($fileDeniedDirectives); + foreach ($deniedDirectivesInFile as $key => $deniedDirective) { + if (isset($this->whitelistVarsInFiles[$deniedDirective])) { + foreach ($this->whitelistVarsInFiles[$deniedDirective] as $whitelistFile) { + if (strpos($file, $whitelistFile) !== false) { + unset($deniedDirectivesInFile[$key]); + } + } + } + } + if ($deniedDirectivesInFile) { + $deniedDirectives[$file] = $deniedDirectivesInFile; + } } } } From 731b58f10925f9fa88e9541db91d8706f8ddcb63 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 12 Jun 2018 19:03:37 +0300 Subject: [PATCH 114/133] 1334: CreateOrderBackendTest rework to support MSI 'Reorder button' new behaviour. --- .../Braintree/Test/TestCase/CreateOrderBackendTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml index cf3b3ae407a49..67bf0f33c3e94 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml @@ -27,7 +27,7 @@ <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Ship, Reorder, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Reorder, Edit</data> <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> @@ -56,7 +56,7 @@ <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree, braintree_sale</data> <data name="status" xsi:type="string">Processing</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Hold, Ship, Reorder</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Hold, Reorder</data> <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> From aa9f0f0c7d466cd5d8aa1660511d3bbc4ffa195f Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Tue, 12 Jun 2018 11:12:15 -0500 Subject: [PATCH 115/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - builds stabilization --- .../Swatches/Controller/Adminhtml/Product/AttributeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php index ba99e43890e1a..805ac0420a77a 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php @@ -174,7 +174,7 @@ public function testLargeOptionsDataSet( array $attributeData, int $expectedOptionsCount, array $expectedLabels - ) { + ) : void { $this->getRequest()->setPostValue($attributeData); $this->dispatch('backend/catalog/product_attribute/save'); $entityTypeId = $this->_objectManager->create( From 32486c5f1e7d96c8f659916ff54350a0104ff8dc Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@magento.com> Date: Tue, 12 Jun 2018 20:55:48 +0300 Subject: [PATCH 116/133] =?UTF-8?q?ENGCOM-1904:=20[Forwardport]=20[Resolve?= =?UTF-8?q?d=20:=20Changing=20@tab-content=5F=5Fborder=20variable=20has=20?= =?UTF-8?q?no=20effect=20in=20B=E2=80=A6=20#15916?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blank/Magento_Catalog/web/css/source/module/_toolbar.less | 2 +- .../luma/Magento_Catalog/web/css/source/module/_listings.less | 4 ++-- .../luma/Magento_Catalog/web/css/source/module/_toolbar.less | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less index 0f335b37879c7..aceccb06d47f7 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less @@ -190,8 +190,8 @@ .toolbar { .products.wrapper ~ & .limiter { - float: right; display: block; + float: right; } } } diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less index 9337bb79e7ed1..a8778da50f70b 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less @@ -277,8 +277,8 @@ } .sidebar & { .product-item-photo { - top: 9px; left: 9px; + top: 9px; } } } @@ -310,8 +310,8 @@ .actions-primary + .actions-secondary { display: table-cell; padding-left: 10px; - width: 50%; vertical-align: middle; + width: 50%; > .action { margin-right: 10px; diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less index ef4c119dd60b0..0997b9739125d 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_toolbar.less @@ -235,8 +235,8 @@ .toolbar { .products.wrapper ~ & .limiter { - float: right; display: block; + float: right; } } } From 8132ea485b32545191aac881625cfc9aba8b62c5 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@magento.com> Date: Wed, 13 Jun 2018 08:09:12 +0300 Subject: [PATCH 117/133] Fixed static test failures --- .../blank/Magento_Catalog/web/css/source/module/_toolbar.less | 2 +- .../luma/Magento_Catalog/web/css/source/module/_listings.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less index aceccb06d47f7..0f335b37879c7 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less @@ -190,8 +190,8 @@ .toolbar { .products.wrapper ~ & .limiter { - display: block; float: right; + display: block; } } } diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less index a8778da50f70b..46bb3b7e89645 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less @@ -277,8 +277,8 @@ } .sidebar & { .product-item-photo { - left: 9px; top: 9px; + left: 9px; } } } From 5d5bd7a7d342686b6002a6ed2f122565b8e30016 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@magento.com> Date: Wed, 13 Jun 2018 10:42:17 +0300 Subject: [PATCH 118/133] Fixed static test failures --- .../blank/Magento_Catalog/web/css/source/module/_toolbar.less | 2 +- .../luma/Magento_Catalog/web/css/source/module/_listings.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less index 0f335b37879c7..aceccb06d47f7 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less @@ -190,8 +190,8 @@ .toolbar { .products.wrapper ~ & .limiter { - float: right; display: block; + float: right; } } } diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less index 46bb3b7e89645..a8778da50f70b 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less @@ -277,8 +277,8 @@ } .sidebar & { .product-item-photo { - top: 9px; left: 9px; + top: 9px; } } } From 7c3d53f4ee819958292d08ddc64ecbcd97353634 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Wed, 13 Jun 2018 11:55:47 +0300 Subject: [PATCH 119/133] 1334: CreateOrderBackendTest rework to support MSI 'Reorder button' new behaviour. --- .../Braintree/Test/TestCase/CreateOrderBackendTest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml index 67bf0f33c3e94..acf15c0e28252 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml @@ -27,7 +27,7 @@ <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree</data> <data name="status" xsi:type="string">Processing</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Reorder, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Invoice, Reorder, Edit</data> <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> @@ -55,8 +55,8 @@ <data name="creditCard/dataset" xsi:type="string">visa_default</data> <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree, braintree_sale</data> - <data name="status" xsi:type="string">Processing</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Hold, Reorder</data> + <data name="status" xsi:type="string">Complete</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Reorder</data> <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> From 0d06ad882506150ed5bb39386a2ff0805c0d07b6 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Wed, 13 Jun 2018 15:29:47 +0300 Subject: [PATCH 120/133] 1334: CreateOrderBackendTest rework to support MSI 'Reorder button' new behaviour. --- .../Test/Block/Adminhtml/Order/Actions.php | 10 ++++++++++ .../Sales/Test/TestStep/CreateShipmentStep.php | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php index 573f28f09b78c..7a6903ef47aac 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php @@ -137,6 +137,16 @@ class Actions extends Block */ protected $confirmModal = '.confirm._show[data-role=modal]'; + /** + * Is shipment can be created. + * + * @return bool + */ + public function canShip() + { + return $this->_rootElement->find($this->ship)->isVisible(); + } + /** * Ship order. * diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php index 79abd438a1f2e..dcee66b44646e 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php @@ -99,13 +99,21 @@ public function run() { $this->orderIndex->open(); $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); - $this->salesOrderView->getPageActions()->ship(); - if (!empty($this->data)) { - $this->orderShipmentNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']); + $shipmentIds = []; + /** + * As this step is used in general scenarios and not all test cases has shippable items(ex: virtual product) + * we need to check, if it possible to create shipment for given order. + */ + if ($this->salesOrderView->getPageActions()->canShip()) { + $this->salesOrderView->getPageActions()->ship(); + if (!empty($this->data)) { + $this->orderShipmentNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']); + } + $this->orderShipmentNew->getFormBlock()->submit(); + $shipmentIds = $this->getShipmentIds(); } - $this->orderShipmentNew->getFormBlock()->submit(); - return ['shipmentIds' => $this->getShipmentIds()]; + return ['shipmentIds' => $shipmentIds]; } /** From 8756cda18fb23cb0eef37fa12aa0b12cc9f99324 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Wed, 13 Jun 2018 12:51:42 -0500 Subject: [PATCH 121/133] MAGETWO-91595: Image doesn't load on frontend PDP if the product name contains double quote " - Fix MFTF tests --- .../Catalog/ActionGroup/AdminCategoryActionGroup.xml | 4 ++-- .../Catalog/ActionGroup/AdminProductActionGroup.xml | 2 +- .../Magento/FunctionalTest/Catalog/Data/ProductData.xml | 2 +- .../Catalog/Test/AdminAddImageForCategoryTest.xml | 2 +- .../FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml | 2 +- .../Catalog/Test/StorefrontProductNameWithDoubleQuote.xml | 6 +++--- .../Magento/FunctionalTest/Cms/Data/CmsPageData.xml | 1 + 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml index 96e40e348a6f2..93b4877952da5 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminCategoryActionGroup.xml @@ -57,7 +57,7 @@ <!--Upload image for category --> <actionGroup name="addCategoryImage"> <arguments> - <argument name="image" defaultValue="ImageUpload"/> + <argument name="image" defaultValue="ProductImage"/> </arguments> <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> <waitForPageLoad time="30" stepKey="waitForPageLoad"/> @@ -81,7 +81,7 @@ <actionGroup name="checkCategoryImageInAdmin"> <arguments> - <argument name="image" defaultValue="ImageUpload"/> + <argument name="image" defaultValue="ProductImage"/> </arguments> <conditionalClick selector="{{AdminCategoryContentSection.sectionHeader}}" dependentSelector="{{AdminCategoryContentSection.uploadButton}}" visible="false" stepKey="openContentSection"/> <waitForPageLoad stepKey="waitForPageLoad"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml index 4e9cfcc29de64..3ef8b961a81af 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml @@ -77,7 +77,7 @@ <!--Upload image for product--> <actionGroup name="addProductImage"> <arguments> - <argument name="image" defaultValue="ImageUpload"/> + <argument name="image" defaultValue="ProductImage"/> </arguments> <conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/> <waitForPageLoad time="30" stepKey="waitForPageRefresh"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml index e88b021e927a2..257f09417291a 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml @@ -154,7 +154,7 @@ <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> <requiredEntity type="custom_attribute">CustomAttributeProductUrlKey</requiredEntity> </entity> - <entity name="ImageUpload" type="uploadImage"> + <entity name="ProductImage" type="uploadImage"> <data key="title" unique="suffix">Image1</data> <data key="price">1.00</data> <data key="file_type">Upload File</data> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageForCategoryTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageForCategoryTest.xml index ba90296d12380..04e34871c8b73 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageForCategoryTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminAddImageForCategoryTest.xml @@ -43,6 +43,6 @@ <actionGroup ref="CheckCategoryOnStorefront" stepKey="CheckCategoryOnStorefront"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <seeElement selector="{{StorefrontCategoryMainSection.imageSource(ImageUpload.filename)}}" stepKey="seeImage"/> + <seeElement selector="{{StorefrontCategoryMainSection.imageSource(ProductImage.filename)}}" stepKey="seeImage"/> </test> </tests> \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml index 7ce754e8f009b..0f466ccc3d994 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/EndToEndB2CAdminTest.xml @@ -39,7 +39,7 @@ <argument name="product" value="SimpleProduct"/> </actionGroup> <actionGroup ref="addProductImage" stepKey="addImageForProductSimple"> - <argument name="image" value="ImageUpload"/> + <argument name="image" value="ProductImage"/> </actionGroup> <actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/> <click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackToGridSimple"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontProductNameWithDoubleQuote.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontProductNameWithDoubleQuote.xml index 6c6d3961e915c..a848515aee873 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontProductNameWithDoubleQuote.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/StorefrontProductNameWithDoubleQuote.xml @@ -35,13 +35,13 @@ </actionGroup> <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="selectCategory"/> <actionGroup ref="addProductImage" stepKey="addImageToProduct"> - <argument name="image" value="ImageUpload"/> + <argument name="image" value="ProductImage"/> </actionGroup> <actionGroup ref="saveProductForm" stepKey="saveProduct"/> <!--Check product in category listing--> <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="goToCategoryPage"/> - <seeElement selector="{{StorefrontCategoryProductSection.ProductImageByNameAndSrc(SimpleProductNameWithDoubleQuote.name, ImageUpload.fileName)}}" stepKey="seeCorrectImageCategoryPage"/> + <seeElement selector="{{StorefrontCategoryProductSection.ProductImageByNameAndSrc(SimpleProductNameWithDoubleQuote.name, ProductImage.fileName)}}" stepKey="seeCorrectImageCategoryPage"/> <see selector="{{StorefrontCategoryProductSection.ProductTitleByName(SimpleProductNameWithDoubleQuote.name)}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectNameCategoryPage"/> <see selector="{{StorefrontCategoryProductSection.ProductPriceByName(SimpleProductNameWithDoubleQuote.name)}}" userInput="${{SimpleProductNameWithDoubleQuote.price}}" stepKey="seeCorrectPriceCategoryPage"/> <!--Open product display page--> @@ -50,7 +50,7 @@ <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectName"/> <see selector="{{StorefrontProductInfoMainSection.productSku}}" userInput="{{SimpleProductNameWithDoubleQuote.sku}}" stepKey="seeCorrectSku"/> <see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="${{SimpleProductNameWithDoubleQuote.price}}" stepKey="seeCorrectPrice"/> - <seeElement selector="{{StorefrontProductInfoMainSection.productImageSrc(ImageUpload.fileName)}}" stepKey="seeCorrectImage"/> + <seeElement selector="{{StorefrontProductInfoMainSection.productImageSrc(ProductImage.fileName)}}" stepKey="seeCorrectImage"/> <see selector="{{StorefrontProductInfoMainSection.stock}}" userInput="In Stock" stepKey="seeInStock"/> <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$createCategory.name$$" stepKey="seeCorrectBreadCrumbCategory"/> <see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="{{SimpleProductNameWithDoubleQuote.name}}" stepKey="seeCorrectBreadCrumbProduct"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Data/CmsPageData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Data/CmsPageData.xml index 857ac2a2f1b1f..25e55ea756afb 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Data/CmsPageData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Data/CmsPageData.xml @@ -37,6 +37,7 @@ <data key="price">1.00</data> <data key="file_type">Upload File</data> <data key="shareable">Yes</data> + <data key="file">magento.jpg</data> <data key="value">magento.jpg</data> <data key="fileName">magento</data> <data key="extension">jpg</data> From 03011d0ca93be46b14630840da73bbefe96c1b11 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@magento.com> Date: Wed, 13 Jun 2018 13:39:56 -0500 Subject: [PATCH 122/133] MQE-1061: Stabilize RE-develop branch --- .../Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml index cc33059dd10b6..cf7f996736eb3 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml @@ -32,6 +32,7 @@ <!--Create Store view --> <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForAdminSystemStorePage"/> <click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> <selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> From 13927e33337c00b80ff3ec4737e0e2673c7fa0d5 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Wed, 13 Jun 2018 16:27:09 -0500 Subject: [PATCH 123/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - fixed default attribute setting --- .../Controller/Adminhtml/Product/Attribute/Save.php | 2 +- .../Magento/Catalog/view/adminhtml/web/js/options.js | 11 ++++++++++- .../Adminhtml/Product/Attribute/Plugin/Save.php | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 787053bb0d182..817de6828e48d 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -331,7 +331,7 @@ private function preprocessOptionsData(&$data) foreach ($serializedOptions as $serializedOption) { $option = []; parse_str($serializedOption, $option); - $data = array_merge_recursive($data, $option); + $data = array_replace_recursive($data, $option); } } unset($data['serialized_options']); diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index 4952c8bac250c..afd79adf000e6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -183,7 +183,16 @@ define([ editForm.on('submit', function () { optionPanel.find('input') .each(function () { - optionsValues.push(this.name + '=' + jQuery(this).val()); + if (this.disabled) { + return; + } + if (this.type == 'checkbox' || this.type == 'radio') { + if (this.checked) { + optionsValues.push(this.name + '=' + jQuery(this).val()); + } + } else { + optionsValues.push(this.name + '=' + jQuery(this).val()); + } }); jQuery('<input>') .attr({ diff --git a/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php b/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php index 98691be5ef103..15432b13455a9 100644 --- a/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php +++ b/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php @@ -26,7 +26,9 @@ public function beforeDispatch(Attribute\Save $subject, RequestInterface $reques $data = $request->getPostValue(); //Data is serialized to overcome issues caused by max_input_vars value if it's modification is unavailable. //See subject controller code and comments for more info. - if (isset($data['serialized_swatch_values'])) { + if (isset($data['serialized_swatch_values']) + && in_array($data['frontend_input'], ['swatch_visual', 'swatch_text']) + ) { $data['serialized_options'] = $data['serialized_swatch_values']; } unset($data['serialized_swatch_values']); From d3e8f82f323e9697d66b9976d36b6b16e0b5ed36 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Wed, 13 Jun 2018 16:58:56 -0500 Subject: [PATCH 124/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - test fix --- .../Swatches/Controller/Adminhtml/Product/AttributeTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php index 805ac0420a77a..969d9530ae542 100644 --- a/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Swatches/Controller/Adminhtml/Product/AttributeTest.php @@ -154,8 +154,8 @@ public function getLargeSwatchesAmountAttributeData() : array $maxInputVars = ini_get('max_input_vars'); // Each option is at least 7 variables array for a visual swatch. // Set options count to exceed max_input_vars by 20 options (140 variables). - $swatchVisualOptionsCount = floor($maxInputVars / 7) + 20; - $swatchTextOptionsCount = floor($maxInputVars / 4) + 80; + $swatchVisualOptionsCount = (int)floor($maxInputVars / 7) + 20; + $swatchTextOptionsCount = (int)floor($maxInputVars / 4) + 80; return [ 'visual swatches' => $this->getSwatchVisualDataSet($swatchVisualOptionsCount), 'text swatches' => $this->getSwatchTextDataSet($swatchTextOptionsCount) From 23288330fd5d15961ef20bf533dc56e21d44cfaa Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Wed, 13 Jun 2018 17:33:49 -0500 Subject: [PATCH 125/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - test fix --- app/code/Magento/Catalog/view/adminhtml/web/js/options.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index afd79adf000e6..6ea005915763c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -186,7 +186,8 @@ define([ if (this.disabled) { return; } - if (this.type == 'checkbox' || this.type == 'radio') { + + if (this.type === 'checkbox' || this.type === 'radio') { if (this.checked) { optionsValues.push(this.name + '=' + jQuery(this).val()); } From c6f89a122959a41d66fda23eb3c810b0f5412fe1 Mon Sep 17 00:00:00 2001 From: ledianh <ledian.hymetllari@gmail.com> Date: Wed, 6 Jun 2018 22:37:14 +0200 Subject: [PATCH 126/133] fixed word typo --- lib/web/mage/apply/scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/apply/scripts.js b/lib/web/mage/apply/scripts.js index f35e9a2140e67..bf211c38adba5 100644 --- a/lib/web/mage/apply/scripts.js +++ b/lib/web/mage/apply/scripts.js @@ -14,7 +14,7 @@ define([ virtuals = []; /** - * Adds components to the virtula list. + * Adds components to the virtual list. * * @param {Object} components */ From 54597ebef7f9c4e4e9071698c2052ef3bc4435c1 Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza <enarc@atwix.com> Date: Thu, 14 Jun 2018 10:49:14 +0200 Subject: [PATCH 127/133] Added unit test for CheckRegisterCheckoutObserver --- .../CheckRegisterCheckoutObserverTest.php | 211 ++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 app/code/Magento/Captcha/Test/Unit/Observer/CheckRegisterCheckoutObserverTest.php diff --git a/app/code/Magento/Captcha/Test/Unit/Observer/CheckRegisterCheckoutObserverTest.php b/app/code/Magento/Captcha/Test/Unit/Observer/CheckRegisterCheckoutObserverTest.php new file mode 100644 index 0000000000000..6c0618197403f --- /dev/null +++ b/app/code/Magento/Captcha/Test/Unit/Observer/CheckRegisterCheckoutObserverTest.php @@ -0,0 +1,211 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Captcha\Test\Unit\Observer; + +use Magento\Captcha\Model\DefaultModel as CaptchaModel; +use Magento\Captcha\Observer\CheckRegisterCheckoutObserver; +use Magento\Captcha\Helper\Data as CaptchaDataHelper; +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\ActionFlag; +use Magento\Captcha\Observer\CaptchaStringResolver; +use Magento\Checkout\Model\Type\Onepage; +use Magento\Framework\App\Request\Http; +use Magento\Framework\App\Response\Http as HttpResponse; +use Magento\Framework\Event\Observer; +use Magento\Framework\Json\Helper\Data as JsonHelper; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Quote\Model\Quote; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class CheckRegisterCheckoutObserverTest extends \PHPUnit\Framework\TestCase +{ + const FORM_ID = 'register_during_checkout'; + + /** + * @var CheckRegisterCheckoutObserver + */ + private $checkRegisterCheckoutObserver; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Observer + */ + private $observer; + + /** + * @var HttpResponse|\PHPUnit_Framework_MockObject_MockObject + */ + private $responseMock; + + /** + * @var HttpResponse|\PHPUnit_Framework_MockObject_MockObject + */ + private $requestMock; + + /** + * @var ActionFlag|\PHPUnit_Framework_MockObject_MockObject + */ + private $actionFlagMock; + + /** + * @var CaptchaStringResolver|\PHPUnit_Framework_MockObject_MockObject + */ + private $captchaStringResolverMock; + + /** + * @var JsonHelper|\PHPUnit_Framework_MockObject_MockObject + */ + private $jsonHelperMock; + + /** + * @var CaptchaModel|\PHPUnit_Framework_MockObject_MockObject + */ + private $captchaModelMock; + + /** + * @var Quote|\PHPUnit_Framework_MockObject_MockObject + */ + private $quoteModelMock; + + /** + * @var Action|\PHPUnit_Framework_MockObject_MockObject + */ + private $controllerMock; + + protected function setUp() + { + $onepageModelTypeMock = $this->createMock(Onepage::class); + $captchaDataHelperMock = $this->createMock(CaptchaDataHelper::class); + $this->objectManager = new ObjectManager($this); + $this->actionFlagMock = $this->createMock(ActionFlag::class); + $this->captchaStringResolverMock = $this->createMock(CaptchaStringResolver::class); + $this->captchaModelMock = $this->createMock(CaptchaModel::class); + $this->quoteModelMock = $this->createMock(Quote::class); + $this->controllerMock = $this->createMock(Action::class); + $this->requestMock = $this->createMock(Http::class); + $this->responseMock = $this->createMock(HttpResponse::class); + $this->observer = new Observer(['controller_action' => $this->controllerMock]); + $this->jsonHelperMock = $this->createMock(JsonHelper::class); + + $this->checkRegisterCheckoutObserver = $this->objectManager->getObject( + CheckRegisterCheckoutObserver::class, + [ + 'helper' => $captchaDataHelperMock, + 'actionFlag' => $this->actionFlagMock, + 'captchaStringResolver' => $this->captchaStringResolverMock, + 'typeOnepage' => $onepageModelTypeMock, + 'jsonHelper' => $this->jsonHelperMock + ] + ); + + $captchaDataHelperMock->expects($this->once()) + ->method('getCaptcha') + ->with(self::FORM_ID) + ->willReturn($this->captchaModelMock); + $onepageModelTypeMock->expects($this->once()) + ->method('getQuote') + ->willReturn($this->quoteModelMock); + } + + public function testCheckRegisterCheckoutForGuest() + { + $this->quoteModelMock->expects($this->once()) + ->method('getCheckoutMethod') + ->willReturn(Onepage::METHOD_GUEST); + $this->captchaModelMock->expects($this->never()) + ->method('isRequired'); + + $this->checkRegisterCheckoutObserver->execute($this->observer); + } + + public function testCheckRegisterCheckoutWithNoCaptchaRequired() + { + $this->quoteModelMock->expects($this->once()) + ->method('getCheckoutMethod') + ->willReturn(Onepage::METHOD_REGISTER); + $this->captchaModelMock->expects($this->once()) + ->method('isRequired') + ->willReturn(false); + $this->captchaModelMock->expects($this->never()) + ->method('isCorrect'); + + $this->checkRegisterCheckoutObserver->execute($this->observer); + } + + public function testCheckRegisterCheckoutWithIncorrectCaptcha() + { + $captchaValue = 'some_word'; + $encodedJsonValue = '{}'; + + $this->quoteModelMock->expects($this->once()) + ->method('getCheckoutMethod') + ->willReturn(Onepage::METHOD_REGISTER); + $this->captchaModelMock->expects($this->once()) + ->method('isRequired') + ->willReturn(true); + $this->controllerMock->expects($this->once()) + ->method('getRequest') + ->willReturn($this->requestMock); + $this->controllerMock->expects($this->once()) + ->method('getResponse') + ->willReturn($this->responseMock); + $this->controllerMock->expects($this->once()) + ->method('getResponse') + ->willReturn($this->responseMock); + $this->captchaStringResolverMock->expects($this->once()) + ->method('resolve') + ->with($this->requestMock, self::FORM_ID) + ->willReturn($captchaValue); + $this->captchaModelMock->expects($this->once()) + ->method('isCorrect') + ->with($captchaValue) + ->willReturn(false); + $this->actionFlagMock->expects($this->once()) + ->method('set') + ->with('', Action::FLAG_NO_DISPATCH, true); + $this->jsonHelperMock->expects($this->once()) + ->method('jsonEncode') + ->willReturn($encodedJsonValue); + $this->responseMock->expects($this->once()) + ->method('representJson') + ->with($encodedJsonValue); + + $this->checkRegisterCheckoutObserver->execute($this->observer); + } + + public function testCheckRegisterCheckoutWithCorrectCaptcha() + { + $this->quoteModelMock->expects($this->once()) + ->method('getCheckoutMethod') + ->willReturn(Onepage::METHOD_REGISTER); + $this->captchaModelMock->expects($this->once()) + ->method('isRequired') + ->willReturn(true); + $this->controllerMock->expects($this->once()) + ->method('getRequest') + ->willReturn($this->requestMock); + $this->captchaStringResolverMock->expects($this->once()) + ->method('resolve') + ->with($this->requestMock, self::FORM_ID) + ->willReturn('some_word'); + $this->captchaModelMock->expects($this->once()) + ->method('isCorrect') + ->with('some_word') + ->willReturn(true); + $this->actionFlagMock->expects($this->never()) + ->method('set'); + + $this->checkRegisterCheckoutObserver->execute($this->observer); + } +} From f0cfe5c97493c7726b127ed2c1c87cf5e9d07ead Mon Sep 17 00:00:00 2001 From: Thomas Klein <thomas@bird.eu> Date: Tue, 12 Jun 2018 11:58:57 +0200 Subject: [PATCH 128/133] improve retrieval of first elem --- .../Magento/Rule/Model/Action/AbstractAction.php | 15 +++++++++------ app/code/Magento/Rule/Model/Condition/Combine.php | 13 ++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Rule/Model/Action/AbstractAction.php b/app/code/Magento/Rule/Model/Action/AbstractAction.php index fb15edf8a4893..4d56f6cc56edc 100644 --- a/app/code/Magento/Rule/Model/Action/AbstractAction.php +++ b/app/code/Magento/Rule/Model/Action/AbstractAction.php @@ -49,13 +49,16 @@ public function __construct( $this->loadAttributeOptions()->loadOperatorOptions()->loadValueOptions(); - foreach (array_keys($this->getAttributeOption()) as $attr) { - $this->setAttribute($attr); - break; + $attributes = $this->getAttributeOption(); + if ($attributes) { + reset($attributes); + $this->setAttribute(key($attributes)); } - foreach (array_keys($this->getOperatorOption()) as $operator) { - $this->setOperator($operator); - break; + + $operators = $this->getOperatorOption(); + if ($operators) { + reset($operators); + $this->setOperator(key($operators)); } } diff --git a/app/code/Magento/Rule/Model/Condition/Combine.php b/app/code/Magento/Rule/Model/Condition/Combine.php index 24ed1cb497472..48873aec66295 100644 --- a/app/code/Magento/Rule/Model/Condition/Combine.php +++ b/app/code/Magento/Rule/Model/Condition/Combine.php @@ -46,10 +46,8 @@ public function __construct(Context $context, array $data = []) $this->loadAggregatorOptions(); $options = $this->getAggregatorOptions(); if ($options) { - foreach (array_keys($options) as $aggregator) { - $this->setAggregator($aggregator); - break; - } + reset($options); + $this->setAggregator(key($options)); } } @@ -90,9 +88,10 @@ public function getAggregatorName() public function getAggregatorElement() { if ($this->getAggregator() === null) { - foreach (array_keys($this->getAggregatorOption()) as $key) { - $this->setAggregator($key); - break; + $options = $this->getAggregatorOption(); + if ($options) { + reset($options); + $this->setAggregator(key($options)); } } return $this->getForm()->addField( From 51e12bf50a7d8fbac3814df7be693b0e56cac0c8 Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza <enarc@atwix.com> Date: Thu, 14 Jun 2018 11:53:34 +0200 Subject: [PATCH 129/133] Fixed long variable name --- .../Unit/Observer/CheckRegisterCheckoutObserverTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Captcha/Test/Unit/Observer/CheckRegisterCheckoutObserverTest.php b/app/code/Magento/Captcha/Test/Unit/Observer/CheckRegisterCheckoutObserverTest.php index 6c0618197403f..89012ef653838 100644 --- a/app/code/Magento/Captcha/Test/Unit/Observer/CheckRegisterCheckoutObserverTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Observer/CheckRegisterCheckoutObserverTest.php @@ -86,7 +86,7 @@ class CheckRegisterCheckoutObserverTest extends \PHPUnit\Framework\TestCase protected function setUp() { $onepageModelTypeMock = $this->createMock(Onepage::class); - $captchaDataHelperMock = $this->createMock(CaptchaDataHelper::class); + $captchaHelperMock = $this->createMock(CaptchaDataHelper::class); $this->objectManager = new ObjectManager($this); $this->actionFlagMock = $this->createMock(ActionFlag::class); $this->captchaStringResolverMock = $this->createMock(CaptchaStringResolver::class); @@ -101,7 +101,7 @@ protected function setUp() $this->checkRegisterCheckoutObserver = $this->objectManager->getObject( CheckRegisterCheckoutObserver::class, [ - 'helper' => $captchaDataHelperMock, + 'helper' => $captchaHelperMock, 'actionFlag' => $this->actionFlagMock, 'captchaStringResolver' => $this->captchaStringResolverMock, 'typeOnepage' => $onepageModelTypeMock, @@ -109,7 +109,7 @@ protected function setUp() ] ); - $captchaDataHelperMock->expects($this->once()) + $captchaHelperMock->expects($this->once()) ->method('getCaptcha') ->with(self::FORM_ID) ->willReturn($this->captchaModelMock); From 79fff2ab4b05bb127b81e09d8fa1ad37bf642ed9 Mon Sep 17 00:00:00 2001 From: Leandro Ferraz Luvisotto <l.luvisotto@youwe.nl> Date: Tue, 12 Jun 2018 11:46:09 +0200 Subject: [PATCH 130/133] Disabling sorting in glob and scandir functions for better performance --- .../framework/Magento/TestFramework/Utility/ChangedFiles.php | 2 +- lib/internal/Magento/Framework/App/Utility/Files.php | 2 +- lib/internal/Magento/Framework/Archive/Tar.php | 2 +- .../Framework/Backup/Test/Unit/_files/app_dirs_rollback.php | 2 +- lib/internal/Magento/Framework/Data/Collection/Filesystem.php | 2 +- lib/internal/Magento/Framework/Filesystem/Io/File.php | 2 +- .../Magento/Framework/Validator/Test/Unit/ConfigTest.php | 2 +- setup/src/Magento/Setup/Fixtures/FixtureModel.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php b/dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php index 6470bc0c22086..3d7f5f2604d7a 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/ChangedFiles.php @@ -32,7 +32,7 @@ public static function getPhpFiles($changedFilesList, $fileTypes = 0) $fileUtilities = Files::init(); if (isset($_ENV['INCREMENTAL_BUILD'])) { $phpFiles = []; - foreach (glob($changedFilesList) as $listFile) { + foreach (glob($changedFilesList, GLOB_NOSORT) as $listFile) { $phpFiles = array_merge($phpFiles, file($listFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)); } array_walk( diff --git a/lib/internal/Magento/Framework/App/Utility/Files.php b/lib/internal/Magento/Framework/App/Utility/Files.php index 7e8d79eead7e1..b0dfc50e9f972 100644 --- a/lib/internal/Magento/Framework/App/Utility/Files.php +++ b/lib/internal/Magento/Framework/App/Utility/Files.php @@ -392,7 +392,7 @@ public function getMainConfigFiles($asDataSet = true) $configXmlPaths = array_merge($globPaths, $configXmlPaths); $files = []; foreach ($configXmlPaths as $xmlPath) { - $files = array_merge($files, glob($xmlPath)); + $files = array_merge($files, glob($xmlPath, GLOB_NOSORT)); } self::$_cache[$cacheKey] = $files; } diff --git a/lib/internal/Magento/Framework/Archive/Tar.php b/lib/internal/Magento/Framework/Archive/Tar.php index ccf9838d6649f..e2a070503f61f 100644 --- a/lib/internal/Magento/Framework/Archive/Tar.php +++ b/lib/internal/Magento/Framework/Archive/Tar.php @@ -252,7 +252,7 @@ protected function _createTar($skipRoot = false, $finalize = false) $file = $this->_getCurrentFile(); if (is_dir($file)) { - $dirFiles = scandir($file); + $dirFiles = scandir($file, SCANDIR_SORT_NONE); if (false === $dirFiles) { throw new \Magento\Framework\Exception\LocalizedException( diff --git a/lib/internal/Magento/Framework/Backup/Test/Unit/_files/app_dirs_rollback.php b/lib/internal/Magento/Framework/Backup/Test/Unit/_files/app_dirs_rollback.php index 7a9814bcd6932..5d4f18037d023 100644 --- a/lib/internal/Magento/Framework/Backup/Test/Unit/_files/app_dirs_rollback.php +++ b/lib/internal/Magento/Framework/Backup/Test/Unit/_files/app_dirs_rollback.php @@ -15,7 +15,7 @@ } } -$files = glob(TESTS_TEMP_DIR . '/Magento/Backup/data/*'); +$files = glob(TESTS_TEMP_DIR . '/Magento/Backup/data/*', GLOB_NOSORT); foreach ($files as $file) { unlink($file); } diff --git a/lib/internal/Magento/Framework/Data/Collection/Filesystem.php b/lib/internal/Magento/Framework/Data/Collection/Filesystem.php index 67d2a020864dd..330ff4e975e8a 100644 --- a/lib/internal/Magento/Framework/Data/Collection/Filesystem.php +++ b/lib/internal/Magento/Framework/Data/Collection/Filesystem.php @@ -243,7 +243,7 @@ protected function _collectRecursive($dir) $dir = [$dir]; } foreach ($dir as $folder) { - if ($nodes = glob($folder . '/*')) { + if ($nodes = glob($folder . '/*', GLOB_NOSORT)) { foreach ($nodes as $node) { $collectedResult[] = $node; } diff --git a/lib/internal/Magento/Framework/Filesystem/Io/File.php b/lib/internal/Magento/Framework/Filesystem/Io/File.php index 7849fdf31031f..c1cfebc7a0ac1 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/File.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/File.php @@ -366,7 +366,7 @@ protected static function _recursiveCallback($dir, array $fileCallback, array $d $dirCallback = $fileCallback; } if (is_dir($dir)) { - foreach (scandir($dir) as $item) { + foreach (scandir($dir, SCANDIR_SORT_NONE) as $item) { if (!strcmp($item, '.') || !strcmp($item, '..')) { continue; } diff --git a/lib/internal/Magento/Framework/Validator/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Validator/Test/Unit/ConfigTest.php index 213a71c0087ea..6717095376625 100644 --- a/lib/internal/Magento/Framework/Validator/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Validator/Test/Unit/ConfigTest.php @@ -51,7 +51,7 @@ public function testConstructException() protected function _initConfig(array $files = null) { if (null === $files) { - $files = glob(__DIR__ . '/_files/validation/positive/*/validation.xml'); + $files = glob(__DIR__ . '/_files/validation/positive/*/validation.xml', GLOB_NOSORT); } $configFiles = []; foreach ($files as $path) { diff --git a/setup/src/Magento/Setup/Fixtures/FixtureModel.php b/setup/src/Magento/Setup/Fixtures/FixtureModel.php index 104c9cb343216..99237e48748fb 100644 --- a/setup/src/Magento/Setup/Fixtures/FixtureModel.php +++ b/setup/src/Magento/Setup/Fixtures/FixtureModel.php @@ -105,7 +105,7 @@ public function reindex(OutputInterface $output) */ public function loadFixtures() { - $files = glob(__DIR__ . DIRECTORY_SEPARATOR . self::FIXTURE_PATTERN); + $files = glob(__DIR__ . DIRECTORY_SEPARATOR . self::FIXTURE_PATTERN, GLOB_NOSORT); foreach ($files as $file) { $file = basename($file, '.php'); From 2493093f5c7cf963ce999e46c23536d561312307 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Thu, 14 Jun 2018 10:34:22 -0500 Subject: [PATCH 131/133] MAGETWO-91595: Image doesn't load on frontend PDP if the product name contains double quote " --- .../Magento/FunctionalTest/Catalog/Data/ProductData.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml index e7152ac76db55..3c6e7d3ddc319 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml @@ -293,6 +293,7 @@ <data key="quantity">1000</data> <data key="weight">1</data> <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> + </entity> <entity name="GetProduct" type="product"> <var key="sku" entityKey="sku" entityType="product"/> </entity> From 1a22d95475fd1f5d2cde30b7661ac39fe2f30e28 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@magento.com> Date: Thu, 14 Jun 2018 12:09:46 -0500 Subject: [PATCH 132/133] MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907 - test fix --- .../Product/Attribute/Plugin/Save.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php b/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php index 15432b13455a9..383c97a166d34 100644 --- a/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php +++ b/app/code/Magento/Swatches/Controller/Adminhtml/Product/Attribute/Plugin/Save.php @@ -24,15 +24,17 @@ class Save public function beforeDispatch(Attribute\Save $subject, RequestInterface $request) { $data = $request->getPostValue(); - //Data is serialized to overcome issues caused by max_input_vars value if it's modification is unavailable. - //See subject controller code and comments for more info. - if (isset($data['serialized_swatch_values']) - && in_array($data['frontend_input'], ['swatch_visual', 'swatch_text']) - ) { - $data['serialized_options'] = $data['serialized_swatch_values']; - } - unset($data['serialized_swatch_values']); + if (isset($data['frontend_input'])) { + //Data is serialized to overcome issues caused by max_input_vars value if it's modification is unavailable. + //See subject controller code and comments for more info. + if (isset($data['serialized_swatch_values']) + && in_array($data['frontend_input'], ['swatch_visual', 'swatch_text']) + ) { + $data['serialized_options'] = $data['serialized_swatch_values']; + unset($data['serialized_swatch_values']); + } + switch ($data['frontend_input']) { case 'swatch_visual': $data[Swatch::SWATCH_INPUT_TYPE_KEY] = Swatch::SWATCH_INPUT_TYPE_VISUAL; From 2fc12877a3efd0a1ad00fc46df8a9f91ebccaae2 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <daniel.ruf@ueberbit.de> Date: Tue, 12 Jun 2018 09:51:02 +0200 Subject: [PATCH 133/133] fix: prevent inline-block issue in name form due to space and font-size --- .../view/frontend/templates/widget/name.phtml | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml b/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml index 73e9c4fa34bb3..223e43c9bb897 100644 --- a/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/widget/name.phtml @@ -28,9 +28,7 @@ $suffix = $block->showSuffix(); ?> <?php if (($prefix || $middle || $suffix) && !$block->getNoWrap()): ?> <div class="field required fullname <?= $block->escapeHtmlAttr($block->getContainerClassName()) ?>"> - <label for="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>" class="label"> - <span><?= $block->escapeHtml(__('Name')) ?></span> - </label> + <label for="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>" class="label"><span><?= $block->escapeHtml(__('Name')) ?></span></label> <div class="control"> <fieldset class="fieldset fieldset-fullname"> <div class="fields"> @@ -38,10 +36,7 @@ $suffix = $block->showSuffix(); <?php if ($prefix): ?> <div class="field field-name-prefix<?php if ($block->isPrefixRequired()) echo ' required' ?>"> - <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('prefix')) ?>"> - <span><?= $block->escapeHtml($block->getStoreLabel('prefix')) ?></span> - </label> - + <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('prefix')) ?>"><span><?= $block->escapeHtml($block->getStoreLabel('prefix')) ?></span></label> <div class="control"> <?php if ($block->getPrefixOptions() === false): ?> <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('prefix')) ?>" @@ -65,10 +60,7 @@ $suffix = $block->showSuffix(); </div> <?php endif; ?> <div class="field field-name-firstname required"> - <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>"> - <span><?= $block->escapeHtml($block->getStoreLabel('firstname')) ?></span> - </label> - + <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>"><span><?= $block->escapeHtml($block->getStoreLabel('firstname')) ?></span></label> <div class="control"> <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('firstname')) ?>" name="<?= $block->escapeHtmlAttr($block->getFieldName('firstname')) ?>" @@ -80,10 +72,7 @@ $suffix = $block->showSuffix(); <?php if ($middle): ?> <?php $isMiddlenameRequired = $block->isMiddlenameRequired(); ?> <div class="field field-name-middlename<?= $isMiddlenameRequired ? ' required' : '' ?>"> - <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('middlename')) ?>"> - <span><?= $block->escapeHtml($block->getStoreLabel('middlename')) ?></span> - </label> - + <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('middlename')) ?>"><span><?= $block->escapeHtml($block->getStoreLabel('middlename')) ?></span></label> <div class="control"> <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('middlename')) ?>" name="<?= $block->escapeHtmlAttr($block->getFieldName('middlename')) ?>" @@ -94,10 +83,7 @@ $suffix = $block->showSuffix(); </div> <?php endif; ?> <div class="field field-name-lastname required"> - <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('lastname')) ?>"> - <span><?= $block->escapeHtml($block->getStoreLabel('lastname')) ?></span> - </label> - + <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('lastname')) ?>"><span><?= $block->escapeHtml($block->getStoreLabel('lastname')) ?></span></label> <div class="control"> <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('lastname')) ?>" name="<?= $block->escapeHtmlAttr($block->getFieldName('lastname')) ?>" @@ -108,10 +94,7 @@ $suffix = $block->showSuffix(); </div> <?php if ($suffix): ?> <div class="field field-name-suffix<?php if ($block->isSuffixRequired()) echo ' required' ?>"> - <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('suffix')) ?>"> - <span><?= $block->escapeHtml($block->getStoreLabel('suffix')) ?></span> - </label> - + <label class="label" for="<?= $block->escapeHtmlAttr($block->getFieldId('suffix')) ?>"><span><?= $block->escapeHtml($block->getStoreLabel('suffix')) ?></span></label> <div class="control"> <?php if ($block->getSuffixOptions() === false): ?> <input type="text" id="<?= $block->escapeHtmlAttr($block->getFieldId('suffix')) ?>"